From efe64f6eda2fefad2cbe8c059e0335eb0318c462 Mon Sep 17 00:00:00 2001 From: Terrasse Date: Thu, 29 Aug 2024 20:08:43 +0800 Subject: [PATCH] add AUR publish workflows --- .github/workflows/pkg-aur-bin.yml | 42 +++++++++++++++++++++++++++++++ .github/workflows/pkg-aur-git.yml | 26 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/pkg-aur-bin.yml create mode 100644 .github/workflows/pkg-aur-git.yml diff --git a/.github/workflows/pkg-aur-bin.yml b/.github/workflows/pkg-aur-bin.yml new file mode 100644 index 0000000..3098df7 --- /dev/null +++ b/.github/workflows/pkg-aur-bin.yml @@ -0,0 +1,42 @@ +# This workflow will publish the `chsrc` package to the AUR +# when there is a new `released` event. +name: Publish AUR Package (chsrc) +on: + release: + types: [ released ] + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Get the release tag + id: get_tag + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} + - name: Validate version tag + run: | + if [[ ! ${{ steps.get_tag.outputs.tag }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Abnormal version tag: ${{ steps.get_tag.outputs.tag }}" + echo "valid=false" >> $GITHUB_ENV + else + echo "version=${{ steps.get_tag.outputs.tag:1 }}" >> $GITHUB_ENV + echo "valid=true" >> $GITHUB_ENV + fi + - name: Fetch PKGBUILD + run: | + wget https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD\?h\=chsrc -O ./PKGBUILD + - name: Update PKGBUILD + run: | + sed -i "s/pkgver=.*/pkgver=${{ env.version }}/" PKGBUILD + - name: Publish to AUR + uses: KSXGitHub/github-actions-deploy-aur@v3.0.1 + with: + pkgname: chsrc + pkgbuild: ./PKGBUILD + updpkgsums: true + test: true # Check that PKGBUILD could be built, and update pkgver + commit_username: ${{ secrets.AUR_USERNAME }} + commit_email: ${{ secrets.AUR_EMAIL }} + # ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + ssh_private_key: placeholder + commit_message: github-action-auto-publish diff --git a/.github/workflows/pkg-aur-git.yml b/.github/workflows/pkg-aur-git.yml new file mode 100644 index 0000000..6366b44 --- /dev/null +++ b/.github/workflows/pkg-aur-git.yml @@ -0,0 +1,26 @@ +# This workflow will publish the `chsrc-git` package to the AUR +# when the main branch is updated. +name: Publish AUR Package (chsrc-git) +on: + workflow_dispatch: + push: + branches: [ "main" ] # chsrc-git syncs with main + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Fetch PKGBUILD + run: | + wget https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD\?h\=chsrc-git -O ./PKGBUILD + - name: Publish to AUR + uses: KSXGitHub/github-actions-deploy-aur@v3.0.1 + with: + pkgname: chsrc-git + pkgbuild: ./PKGBUILD + test: true # Check that PKGBUILD could be built, and update pkgver + commit_username: ${{ secrets.AUR_USERNAME }} + commit_email: ${{ secrets.AUR_EMAIL }} + ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} + commit_message: github-action-auto-publish