Skip to content

Commit da01de3

Browse files
committed
chore(CI): add step to publish release to AUR
1 parent a74221c commit da01de3

File tree

4 files changed

+126
-12
lines changed

4 files changed

+126
-12
lines changed

.github/workflows/release.yaml

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Build and publish a release of OpenGamepadUI using semantic-release whenever
22
# changes are merged into main.
3-
name: "Release"
3+
name: "🎉 Release"
44

55
on:
66
push:
@@ -18,6 +18,7 @@ env:
1818
# Jobs to run
1919
jobs:
2020
release:
21+
name: 🎉 Publish to GitHub
2122
runs-on: ubuntu-latest
2223

2324
steps:
@@ -46,6 +47,46 @@ jobs:
4647
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4748
run: make release
4849

50+
# In ".releaserc.yaml" a step is defined to write the release version to
51+
# ".version.txt" upon successful release. This step checks to see if that
52+
# exists to determine if the other jobs need to run.
53+
- id: status
54+
name: Set release status
55+
shell: bash
56+
run: |
57+
if [ -f .version.txt ]; then
58+
echo "was_released=yes" >> "$GITHUB_OUTPUT"
59+
else
60+
echo "was_released=no" >> "$GITHUB_OUTPUT"
61+
fi
62+
63+
# Upload the package build for the AUR publish step
64+
- name: Upload PKGBUILD
65+
uses: actions/upload-artifact@v4
66+
if: steps.status.outputs.was_released == 'yes'
67+
with:
68+
name: PKGBUILD
69+
path: ./package/archlinux/PKGBUILD
70+
if-no-files-found: error
71+
- name: Upload Release Version
72+
uses: actions/upload-artifact@v4
73+
if: steps.status.outputs.was_released == 'yes'
74+
with:
75+
name: version.txt
76+
path: .version.txt
77+
if-no-files-found: error
78+
include-hidden-files: true
79+
80+
outputs:
81+
should_publish: ${{ steps.status.outputs.was_released }}
82+
83+
publish-docs:
84+
name: 📔 Publish documentation
85+
needs: release
86+
if: needs.release.outputs.should_publish == 'yes'
87+
runs-on: ubuntu-latest
88+
89+
steps:
4990
- name: Trigger documentation generation
5091
run: |
5192
curl -L -X POST \
@@ -54,3 +95,46 @@ jobs:
5495
-H "X-GitHub-Api-Version: 2022-11-28" \
5596
https://api.github.com/repos/ShadowBlip/OpenGamepadUI/dispatches \
5697
--data '{"event_type": "Trigger Workflow", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}'
98+
99+
publish-to-aur:
100+
name: 🐧 Publish to AUR
101+
needs: release
102+
if: needs.release.outputs.should_publish == 'yes'
103+
runs-on: ubuntu-latest
104+
105+
steps:
106+
- name: Download PKGBUILD
107+
uses: actions/download-artifact@v4
108+
with:
109+
name: PKGBUILD
110+
111+
- name: Download Release Version
112+
uses: actions/download-artifact@v4
113+
with:
114+
name: version.txt
115+
116+
- name: Setup SSH
117+
uses: MrSquaare/ssh-setup-action@v3
118+
with:
119+
host: aur.archlinux.org
120+
private-key: ${{ secrets.AUR_SSH_KEY }}
121+
122+
- name: Checkout AUR bin
123+
run: git clone ssh://[email protected]/opengamepadui-bin.git
124+
125+
- name: Copy PKGBUILD to bin repo
126+
run: cp ./PKGBUILD opengamepadui-bin/
127+
128+
- name: Build bin package
129+
working-directory: opengamepadui-bin
130+
run: make in-docker
131+
132+
- name: Commit and publish bin package
133+
shell: bash
134+
working-directory: opengamepadui-bin
135+
run: |
136+
git config user.name "github-actions[bot]"
137+
git config user.email "shadowblip+github-actions[bot]@users.noreply.github.com"
138+
git add .SRCINFO PKGBUILD
139+
git commit -m "Update to $(grep '^pkgver=' PKGBUILD | cut -d'=' -f2)"
140+
git push origin master

.releaserc.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,27 @@ plugins:
2323
- core/global/version.tres
2424
from: "core = .*"
2525
to: 'core = "${nextRelease.version}"'
26-
#results:
27-
# - file: core/global/version.tres
28-
# hasChanged: true
29-
# numMatches: 1
30-
# numReplacements: 1
31-
#countMatches: true
3226
- files:
3327
- package/rpm/opengamepadui.spec
3428
from: "Version: .*"
3529
to: "Version: ${nextRelease.version}"
30+
- files:
31+
- package/archlinux/PKGBUILD
32+
from: "^pkgver=v.*$"
33+
to: "pkgver=v${nextRelease.version}"
34+
35+
# Execute commands to build the project
36+
- - "@semantic-release/exec"
37+
- shell: true
38+
prepareCmd: "make in-docker IMAGE_TAG=4.4.1 TARGET='force-import dist update-pkgbuild-hash'"
39+
publishCmd: "echo '${nextRelease.version}' > .version.txt"
3640

3741
# Commit the following changes to git after other plugins have run
3842
- - "@semantic-release/git"
3943
- assets:
4044
- core/global/version.tres
4145
- package/rpm/opengamepadui.spec
42-
43-
# Execute commands to build the project
44-
- - "@semantic-release/exec"
45-
- shell: true
46-
prepareCmd: "make in-docker IMAGE_TAG=4.4.1 TARGET='force-import dist'"
46+
- package/archlinux/PKGBUILD
4747

4848
# Publish artifacts as a GitHub release
4949
- - "@semantic-release/github"

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ $(CACHE_DIR)/libserialport:
448448
mkdir -p $(CACHE_DIR)/libserialport
449449
tar xvf $(CACHE_DIR)/libserialport.tar -C $(CACHE_DIR)/libserialport
450450

451+
.PHONY: update-pkgbuild-hash
452+
update-pkgbuild-hash: dist/opengamepadui.tar.gz ## Update the PKGBUILD hash
453+
sed -i "s#^sha256sums=.*#sha256sums=('$$(cat dist/opengamepadui.tar.gz.sha256.txt | cut -d' ' -f1)')#g" \
454+
package/archlinux/PKGBUILD
451455

452456
# Refer to .releaserc.yaml for release configuration
453457
.PHONY: release

package/archlinux/PKGBUILD

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Maintainer: Derek J. Clark <[email protected]>
2+
pkgname=opengamepadui-bin
3+
_pkgbase=opengamepadui
4+
pkgver=0.40.4
5+
pkgrel=1
6+
pkgdesc="Open source game launcher"
7+
arch=('x86_64')
8+
url="https://github.com/ShadowBlip/OpenGamepadUI"
9+
license=('GPL')
10+
depends=('glibc' 'gcc-libs' 'libx11' 'libxres' 'libxcb' 'libxext' 'libxau'
11+
'libxdmcp' 'gamescope' 'vulkan-tools' 'inputplumber'
12+
'mesa-utils'
13+
)
14+
optdepends=('firejail' 'bubblewrap' 'wireplumber' 'networkmanager' 'bluez' 'dbus' 'powerstation')
15+
provides=('opengamepadui')
16+
conflicts=('opengamepadui-git')
17+
source=(opengamepadui-v$pkgver.tar.gz::https://github.com/ShadowBlip/OpenGamepadUI/releases/download/v$pkgver/opengamepadui.tar.gz)
18+
19+
sha256sums=('18de3a83d65b79e334a02f2d08d96dedc470ddc5f8c312833b03ea5346832d2b')
20+
21+
package() {
22+
options=('!strip')
23+
cd "$srcdir/${_pkgbase}"
24+
25+
make install PREFIX="${pkgdir}/usr"
26+
}

0 commit comments

Comments
 (0)