-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (106 loc) · 4.09 KB
/
aur-taskers-bin.yml
File metadata and controls
118 lines (106 loc) · 4.09 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Sync AUR taskers-bin
on:
release:
types:
- published
workflow_dispatch:
inputs:
version:
description: Release version to sync (with or without a leading v)
required: true
pkgrel:
description: PKGBUILD pkgrel override
required: false
default: "1"
permissions:
contents: read
jobs:
sync-taskers-bin:
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'v')
runs-on: ubuntu-latest
container:
image: archlinux:base-devel
env:
AUR_PACKAGE: taskers-bin
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_TASKERS_BIN_SSH_PRIVATE_KEY }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Arch tooling
run: |
pacman -Syu --noconfirm --needed git openssh python
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Resolve release inputs
id: release
shell: bash
run: |
if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then
raw_version='${{ github.event.inputs.version }}'
pkgrel='${{ github.event.inputs.pkgrel }}'
else
raw_version='${{ github.event.release.tag_name }}'
pkgrel='1'
fi
version="${raw_version#v}"
if [ -z "$version" ]; then
echo 'failed to determine release version' >&2
exit 1
fi
if [ -z "$pkgrel" ]; then
pkgrel='1'
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "pkgrel=$pkgrel" >> "$GITHUB_OUTPUT"
- name: Verify AUR SSH key is configured
shell: bash
run: |
if [ -z "$AUR_SSH_PRIVATE_KEY" ]; then
echo 'AUR_TASKERS_BIN_SSH_PRIVATE_KEY is not configured' >&2
exit 1
fi
- name: Configure SSH for AUR
shell: bash
run: |
AUR_SSH_DIR="${RUNNER_TEMP}/aur-ssh"
install -dm700 "$AUR_SSH_DIR"
printf '%s\n' "$AUR_SSH_PRIVATE_KEY" > "$AUR_SSH_DIR/id_ed25519"
chmod 600 "$AUR_SSH_DIR/id_ed25519"
ssh-keyscan -H aur.archlinux.org > "$AUR_SSH_DIR/known_hosts"
- name: Clone AUR package repo
shell: bash
run: |
AUR_SSH_DIR="${RUNNER_TEMP}/aur-ssh"
git -c core.sshCommand="ssh -i '$AUR_SSH_DIR/id_ed25519' -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile='$AUR_SSH_DIR/known_hosts'" \
clone "ssh://aur@aur.archlinux.org/${AUR_PACKAGE}.git" aur-repo
- name: Render taskers-bin package sources
shell: bash
run: |
find aur-repo -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +
for attempt in 1 2 3 4 5; do
if python scripts/render_taskers_bin_aur.py \
--version '${{ steps.release.outputs.version }}' \
--pkgrel '${{ steps.release.outputs.pkgrel }}' \
--repository '${{ github.repository }}' \
--output-dir aur-repo; then
exit 0
fi
echo "render attempt ${attempt} failed; retrying in 15s" >&2
sleep 15
done
echo 'failed to render taskers-bin sources from the published release manifest' >&2
exit 1
- name: Commit and push AUR update
shell: bash
run: |
cd aur-repo
git config user.name 'Taskers Release Bot'
git config user.email 'taskers-release-bot@users.noreply.github.com'
git add PKGBUILD .SRCINFO taskers-entrypoint.sh dev.taskers.app.desktop taskers.svg LICENSE
if git diff --cached --quiet; then
echo 'No taskers-bin AUR changes to push.'
exit 0
fi
git commit -m "Update to v${{ steps.release.outputs.version }}-${{ steps.release.outputs.pkgrel }}"
AUR_SSH_DIR="${RUNNER_TEMP}/aur-ssh"
git -c core.sshCommand="ssh -i '$AUR_SSH_DIR/id_ed25519' -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile='$AUR_SSH_DIR/known_hosts'" \
push origin HEAD