Skip to content

Publish a release

Publish a release #49

Workflow file for this run

name: Publish a release
on:
workflow_dispatch:
inputs: {}
jobs:
gh_release:
runs-on: ubuntu-latest
outputs:
release_number: ${{ steps.determine_number.outputs.release_number }}
env:
GH_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine release number
id: determine_number
run: |
echo release_number=$(( 1 + $(gh release list --json tagName |
jq --raw-output '.[] | .tagName' |
cut -d '-' -f 2 |
sort -n -r |
head -n 1) )) >> "$GITHUB_OUTPUT"
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: "release-${{ steps.determine_number.outputs.release_number }}"
name: "Release ${{ steps.determine_number.outputs.release_number }}"
prepare_pkgbuild:
runs-on: ubuntu-latest
needs: gh_release
env:
TARBALL_URL: https://github.com/janbuchar/rorqual/archive/refs/tags/release-${{ needs.gh_release.outputs.release_number }}.tar.gz
RELEASE_NUMBER: ${{ needs.gh_release.outputs.release_number }}
GH_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Poetry
uses: abatilo/actions-poetry@v2
- name: Use cache
uses: actions/cache@v4
with:
path: out/
key: ${{ github.run_id }}
- name: Prepare output dir
run: mkdir -p out
- name: Create requirements.txt
run: |
poetry export -f requirements.txt --without-hashes --without dev -o out/requirements.txt
cat out/requirements.txt
- name: Copy launcher
run: cp aur/rorqual out/rorqual
- name: Create PKGBUILD
run: |
cat aur/PKGBUILD.template |
TARBALL_HASH=$(gh api $TARBALL_URL | sha256sum | cut -f 1 -d " ") \
REQUIREMENTS_HASH=$(sha256sum out/requirements.txt | cut -f 1 -d " ") \
LAUNCHER_HASH=$(sha256sum out/rorqual | cut -f 1 -d " ") \
envsubst '${TARBALL_URL} ${RELEASE_NUMBER} ${TARBALL_HASH} ${REQUIREMENTS_HASH} ${LAUNCHER_HASH}' > out/PKGBUILD
cat out/PKGBUILD
aur_push:
runs-on: ubuntu-latest
needs: prepare_pkgbuild
steps:
- name: Use cache
uses: actions/cache@v4
with:
path: out/
key: ${{ github.run_id }}
- name: Prepare output dir
run: mkdir -p out
- name: Setup AUR SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.AUR_PRIVATE_KEY }}
- name: Checkout AUR package
run: |
mkdir -p .ssh
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
git init
git remote add origin ssh://[email protected]/rorqual-venv.git
git pull origin master
- name: Apply changes
run: |
mv out/* ./
rm -rf out
- name: Prepare .SRCINFO
uses: heyhusen/[email protected]
with:
flags: ''
namcap: false
srcinfo: true
- name: Push to AUR
run: |
git config --global user.email "[email protected]"
git config --global user.name "Jan Buchar"
git add .
git commit -m "Release ${{ needs.gh_release.outputs.release_number }}"
git push origin master