forked from bjarneo/cliamp
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (95 loc) · 3.91 KB
/
aur.yml
File metadata and controls
109 lines (95 loc) · 3.91 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
name: Publish to AUR
on:
workflow_run:
workflows: ["Release"]
types: [completed]
jobs:
aur:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Extract version
id: version
run: |
TAG="${{ github.event.workflow_run.head_branch }}"
echo "pkgver=${TAG#v}" >> "$GITHUB_OUTPUT"
- name: Generate PKGBUILD
env:
PKGVER: ${{ steps.version.outputs.pkgver }}
REPO: ${{ github.repository }}
run: |
SOURCE_URL="https://github.com/${REPO}/archive/refs/tags/v${PKGVER}.tar.gz"
SHA256=$(curl -sL "$SOURCE_URL" | sha256sum | cut -d' ' -f1)
cat > PKGBUILD <<'HEREDOC'
# Maintainer: bjarneo <https://github.com/bjarneo>
pkgname=cliamp
pkgver=PKGVER_PLACEHOLDER
pkgrel=1
pkgdesc='A retro terminal music player inspired by Winamp 2.x'
arch=('x86_64' 'aarch64')
url='https://github.com/bjarneo/cliamp'
license=('MIT')
depends=('alsa-lib' 'flac' 'libvorbis' 'libogg' 'ffmpeg' 'yt-dlp')
optdepends=('pipewire-alsa: audio output on PipeWire systems'
'pulseaudio-alsa: audio output on PulseAudio systems')
makedepends=('go')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/bjarneo/cliamp/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('SHA256_PLACEHOLDER')
build() {
cd "${pkgname}-${pkgver}"
export CGO_ENABLED=1
go build -trimpath -buildmode=pie \
-ldflags="-s -w -X main.version=v${pkgver} -linkmode=external" \
-o cliamp .
}
package() {
cd "${pkgname}-${pkgver}"
install -Dm755 cliamp "${pkgdir}/usr/bin/cliamp"
install -Dm644 cliamp.desktop "${pkgdir}/usr/share/applications/cliamp.desktop"
install -Dm644 Cliamp.png "${pkgdir}/usr/share/icons/hicolor/512x512/apps/cliamp.png"
install -Dm644 Cliamp.png "${pkgdir}/usr/share/pixmaps/cliamp.png"
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
HEREDOC
sed -i 's/^ //' PKGBUILD
sed -i "s|PKGVER_PLACEHOLDER|${PKGVER}|" PKGBUILD
sed -i "s|SHA256_PLACEHOLDER|${SHA256}|" PKGBUILD
cat PKGBUILD
- name: Publish to AUR
env:
AUR_SSH_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
AUR_USERNAME: ${{ secrets.AUR_USERNAME }}
AUR_EMAIL: ${{ secrets.AUR_EMAIL }}
PKGVER: ${{ steps.version.outputs.pkgver }}
run: |
# Setup SSH
mkdir -p ~/.ssh
echo "$AUR_SSH_KEY" > ~/.ssh/aur
chmod 600 ~/.ssh/aur
ssh-keyscan -t rsa,ecdsa,ed25519 aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null
cat >> ~/.ssh/config <<EOF
Host aur.archlinux.org
IdentityFile ~/.ssh/aur
User aur
EOF
# Clone AUR repo
git clone ssh://aur@aur.archlinux.org/cliamp.git aur-repo
cd aur-repo
git config user.name "$AUR_USERNAME"
git config user.email "$AUR_EMAIL"
# Copy PKGBUILD and generate .SRCINFO
cp ../PKGBUILD .
docker run --rm -v "$PWD/PKGBUILD:/PKGBUILD:ro" archlinux:base bash -c \
'pacman -Sy --noconfirm pacman-contrib >&2 && cp /PKGBUILD /tmp/ && cd /tmp && chown nobody PKGBUILD && runuser -u nobody -- makepkg --printsrcinfo' > .SRCINFO
# Commit and push
git add PKGBUILD .SRCINFO
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "Update to v${PKGVER}"
git push
fi