Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AUR自动构建支持 #59

Merged
merged 8 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/pkg-aur-bin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will publish the `chsrc` package to the AUR
# when there is a new `released` event.
# Note: only normal version tags like `v1.2.3` will be published.
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 "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
ccmywish marked this conversation as resolved.
Show resolved Hide resolved
- name: Validate version tag
run: |
if [[ ! $tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
Jerry-Terrasse marked this conversation as resolved.
Show resolved Hide resolved
echo "Abnormal version tag: $tag"
echo "valid=0" >> $GITHUB_ENV
else
version=$(echo $tag | sed 's/^v//')
echo "version=$version" >> $GITHUB_ENV
echo "valid=1" >> $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=$version/" PKGBUILD
- name: Publish to AUR
if: env.valid == '1'
uses: KSXGitHub/[email protected]
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 }}
commit_message: github-action-auto-publish
26 changes: 26 additions & 0 deletions .github/workflows/pkg-aur-git.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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