-
-
Notifications
You must be signed in to change notification settings - Fork 270
Expand file tree
/
Copy pathpub-AUR-chsrc-and-chsrc-bin.yml
More file actions
75 lines (72 loc) · 2.56 KB
/
pub-AUR-chsrc-and-chsrc-bin.yml
File metadata and controls
75 lines (72 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# ---------------------------------------------------------------
# Workflow File : pub-AUR-chsrc-and-chsrc-bin.yml
# File Authors : Terrasse <terrasse@qq.com>
# Contributors : Nul None <nul@none.org>
# |
# Created On : <2024-08-29>
# Last Modified : <2025-03-18>
#
# Publish the 2 packages to AUR when a new release is created:
# 1. chsrc
# 2. chsrc-bin
#
# Note: only normal version tags like 'v1.2.3' will be published
# ---------------------------------------------------------------
name: Publish 'chsrc' and 'chsrc-bin' to AUR
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
- name: Validate version tag
run: |
if [[ ! $tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
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-bin -O ./PKGBUILD_bin
- name: Update PKGBUILD
run: |
sed -i "s/pkgver=.*/pkgver=$version/" PKGBUILD_bin
- name: Publish chsrc-bin to AUR
if: env.valid == '1'
uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
with:
pkgname: chsrc-bin
pkgbuild: ./PKGBUILD_bin
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 v${{ env.version }}"
- 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 chsrc to AUR
if: env.valid == '1'
uses: KSXGitHub/github-actions-deploy-aur@v4.1.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 }}
commit_message: "github-action-auto-publish v${{ env.version }}"