aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2026-02-24 15:08:40 +0800
committerGitHub <noreply@github.com>2026-02-24 15:08:40 +0800
commit29f94e393aa3b83d33dc3b8911c7b3486fc8ff55 (patch)
treee29b1fc86c7462cd9c9c24542b6bb68ea2ef0c03
parente61e84f49a1cfeb6b1b50d9304fee6b680aeaca8 (diff)
downloadsoon-29f94e393aa3b83d33dc3b8911c7b3486fc8ff55.tar.gz
soon-29f94e393aa3b83d33dc3b8911c7b3486fc8ff55.zip
fix(ci): update AUR publish workflow for multiple branches
-rw-r--r--.github/workflows/publish-aur.yml63
1 files changed, 41 insertions, 22 deletions
diff --git a/.github/workflows/publish-aur.yml b/.github/workflows/publish-aur.yml
index 88fce44..4bfb56d 100644
--- a/.github/workflows/publish-aur.yml
+++ b/.github/workflows/publish-aur.yml
@@ -1,35 +1,54 @@
name: Publish to AUR
-
on:
push:
+ branches:
+ - main
+ - master
tags:
- - 'v*'
+ - '*'
+ pull_request:
+ workflow_dispatch:
+
+permissions:
+ contents: read
jobs:
- publish-aur:
- name: Publish to AUR
+ aur:
+ name: Publish to AUR when tag starts with v
runs-on: ubuntu-latest
+ if: startsWith(github.ref, 'refs/tags/v')
+
steps:
- - name: Checkout code
+ - 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: Extract version
- id: version
- run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
+ - name: Clone AUR repository
+ run: |
+ git clone ssh://aur@aur.archlinux.org/soon.git aur-repo
- - name: Update PKGBUILD version
+ - name: Update PKGBUILD and .SRCINFO in AUR repo
run: |
- sed -i "s/^pkgver=.*/pkgver=$/" PKGBUILD
- sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD
+ cd aur-repo
+ cp ../PKGBUILD .
+ makepkg --printsrcinfo > .SRCINFO
+ git add PKGBUILD .SRCINFO
- - name: Publish AUR package
- uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
- with:
- pkgname: soon
- pkgbuild: ./PKGBUILD
- updpkgsums: true
- commit_username: ${AUR_USERNAME}
- commit_email: ${AUR_EMAIL}
- ssh_private_key: ${AUR_SSH_PRIVATE_KEY}
- commit_message: "Update to version $"
- ssh_keyscan_types: rsa,ecdsa,ed25519
+ 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