aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2026-02-24 16:31:04 +0800
committerGitHub <noreply@github.com>2026-02-24 16:31:04 +0800
commit5dd006372ffbe0bd3e77966ed94147b18dd5f3b9 (patch)
treeb8e64c522835d99744484f87e20298dce64a4c23
parent8f38a248e07d92fcdc207faad9353a20737c1ad7 (diff)
downloadsoon-5dd006372ffbe0bd3e77966ed94147b18dd5f3b9.tar.gz
soon-5dd006372ffbe0bd3e77966ed94147b18dd5f3b9.zip
Refactor AUR publish workflow for better tag handling
-rw-r--r--.github/workflows/publish-aur.yml106
1 files changed, 53 insertions, 53 deletions
diff --git a/.github/workflows/publish-aur.yml b/.github/workflows/publish-aur.yml
index f6e53f6..73edde7 100644
--- a/.github/workflows/publish-aur.yml
+++ b/.github/workflows/publish-aur.yml
@@ -1,56 +1,56 @@
name: Publish to AUR
on:
- push:
- branches:
- - main
- - master
- tags:
- - '*'
- pull_request:
- workflow_dispatch:
-
-permissions:
- contents: read
-
+ push:
+ branches:
+ - main
+ - master
+ tags:
+ - 'v*'
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: 'Tag (v开头)'
+ required: false
+ type: string
+
jobs:
- aur:
- name: Publish to AUR when tag starts with v
- runs-on: ubuntu-latest
- if: startsWith(github.ref, 'refs/tags/v')
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
-
- - name: Set up SSH for AUR
- run: |
- mkdir -p ~/.ssh
- echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts
-
- - name: Clone AUR repository
- run: |
- git clone ssh://aur@aur.archlinux.org/soon.git aur-repo
- cd aur-repo
-
- TAG=${GITHUB_REF##*/}
- VERSION=${TAG#v}
- sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD
-
- makepkg --printsrcinfo > .SRCINFO
-
- git add PKGBUILD .SRCINFO
-
- if git diff --cached --quiet; then
- echo "No changes to commit"
- exit 0
- fi
-
- git config user.name "github-actions[bot]"
- git config user.email "github-actions[bot]@users.noreply.github.com"
-
- git commit -m "release: ${{ github.ref_name }}"
- git push origin master
+ aur:
+ runs-on: ubuntu-latest
+ if: |
+ github.event_name == 'workflow_dispatch' && github.event.inputs.tag != '' ||
+ startsWith(github.ref, 'refs/tags/v')
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Set up SSH for AUR
+ run: |
+ mkdir -p ~/.ssh
+ echo "${{ secrets.AUR_SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
+ chmod 600 ~/.ssh/id_ed25519
+ ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts
+
+ - name: Clone AUR repository and update PKGBUILD
+ run: |
+ git clone ssh://aur@aur.archlinux.org/soon.git aur-repo
+ cd aur-repo
+ if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.tag }}" != "" ];
+ then
+ TAG="${{ github.event.inputs.tag }}"
+ else
+ TAG="${GITHUB_REF##*/}"
+ fi
+ VERSION="${TAG#v}"
+ sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD
+ makepkg --printsrcinfo > .SRCINFO
+ git add PKGBUILD .SRCINFO
+ if git diff --cached --quiet; then
+ echo "No changes to commit"
+ exit 0
+ fi
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ git commit -m "release: $TAG"
+ git push origin master