-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (86 loc) · 3.44 KB
/
release-plz.yaml
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Release-plz
permissions:
pull-requests: write
contents: write
on:
push:
branches:
- main
jobs:
release-plz:
name: Release-plz
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.releases_created }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- id: release
name: Run release-plz
uses: MarcoIeni/release-plz-action@v0.5.64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
publish-aur:
needs: release-plz
runs-on: ubuntu-latest
if: ${{ needs.release-plz.outputs.release_created == 'true' }}
container:
image: archlinux:base-devel
steps:
- uses: actions/checkout@v4
- name: Install git and gnupg
run: pacman -Syu --noconfirm git gnupg openssh
- name: Update PKGBUILD
run: |
version=$(grep '^version =' Cargo.toml | sed 's/.*= "\(.*\)"/\1/')
sed "s/pkgver=.*/pkgver=$version/" PKGBUILD.template > PKGBUILD
sum=$(curl -sL "https://crates.io/api/v1/crates/image-colorizer/$version/download" | sha256sum | cut -d ' ' -f 1)
sed -i "s/sha256sums=('PLACEHOLDER')/sha256sums=('$sum')/" PKGBUILD
- name: Generate .SRCINFO
run: |
mkdir /home/build
chgrp nobody /home/build
chmod g+ws /home/build
setfacl -m u::rwx,g::rwx /home/build
setfacl -d --set u::rwx,g::rwx,o::- /home/build
BUILDDIR=/home/build PKGDEST=/home/build SRCDEST=/home/build runuser -unobody makepkg -- --printsrcinfo > .SRCINFO
ls -a
- name: Import GPG key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
echo "default-cache-ttl 34560000" >> ~/.gnupg/gpg-agent.conf
echo "max-cache-ttl 34560000" >> ~/.gnupg/gpg-agent.conf
echo "RELOADAGENT" | gpg-connect-agent
echo "$GPG_PASSPHRASE" | gpg --batch --passphrase-fd 0 --pinentry-mode loopback -s /dev/null
- name: Publish to AUR
env:
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
mkdir -p /root/.ssh
chmod 700 /root/.ssh
echo "$AUR_SSH_PRIVATE_KEY" > /root/.ssh/aur
chmod 600 /root/.ssh/aur
eval $(ssh-agent -s)
ssh-add /root/.ssh/aur
ssh-keyscan -H aur.archlinux.org >> /root/.ssh/known_hosts
git config --global user.name "Taylor Beeston"
git config --global user.email "beeston.taylor@gmail.com"
git config --global user.signingkey $(gpg --list-secret-keys --keyid-format LONG | grep sec | awk '{print $2}' | cut -d'/' -f2)
git config --global commit.gpgsign true
git clone ssh://aur@aur.archlinux.org/image-colorizer.git aur-repo
cp PKGBUILD .SRCINFO aur-repo/
cd aur-repo
git add PKGBUILD .SRCINFO
git commit -S -m "Update to version $(grep -oP '(?<=pkgver=)\S+' PKGBUILD)"
git push