-
Notifications
You must be signed in to change notification settings - Fork 9
319 lines (260 loc) · 10.6 KB
/
release.yml
File metadata and controls
319 lines (260 loc) · 10.6 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build-linux:
name: Build Linux x86_64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libpulse-dev
- name: Build release binary
run: cargo build --release
- name: Strip binary
run: strip target/release/AetherTune
- name: Package binary
run: |
TAG="${GITHUB_REF#refs/tags/}"
mkdir -p "AetherTune-${TAG}-linux-x86_64"
cp target/release/AetherTune "AetherTune-${TAG}-linux-x86_64/"
cp README.md LICENSE "AetherTune-${TAG}-linux-x86_64/"
tar czf "AetherTune-${TAG}-linux-x86_64.tar.gz" "AetherTune-${TAG}-linux-x86_64"
- name: Compute sha256sum
id: sha
run: |
TAG="${GITHUB_REF#refs/tags/}"
SHA=$(sha256sum "AetherTune-${TAG}-linux-x86_64.tar.gz" | cut -d' ' -f1)
echo "sha256=${SHA}" >> "$GITHUB_OUTPUT"
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-x86_64
path: AetherTune-*.tar.gz
outputs:
sha256: ${{ steps.sha.outputs.sha256 }}
tag: ${{ steps.sha.outputs.tag }}
version: ${{ steps.sha.outputs.version }}
build-windows:
name: Build Windows x86_64
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build release binary
run: cargo build --release
- name: Download mpv
shell: bash
run: |
# Get the latest mpv Windows build from shinchiro's releases via GitHub API
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/shinchiro/mpv-winbuild-cmake/releases/latest \
| grep "browser_download_url.*mpv-x86_64-[0-9].*\.7z" \
| grep -v "dev\|v3" \
| head -1 \
| cut -d'"' -f4)
echo "Downloading mpv from: ${DOWNLOAD_URL}"
curl -L -o mpv.7z "${DOWNLOAD_URL}"
7z x mpv.7z -ompv_extracted
# mpv extracts into a subdirectory, find mpv.exe
find mpv_extracted -name "mpv.exe" -type f
- name: Package binary
shell: bash
run: |
TAG="${GITHUB_REF#refs/tags/}"
mkdir -p "AetherTune-${TAG}-windows-x86_64"
cp target/release/AetherTune.exe "AetherTune-${TAG}-windows-x86_64/"
# mpv extracts into a dated subdirectory, find and copy mpv.exe
MPV_EXE=$(find mpv_extracted -name "mpv.exe" -type f | head -1)
echo "Found mpv at: ${MPV_EXE}"
cp "${MPV_EXE}" "AetherTune-${TAG}-windows-x86_64/"
cp README.md LICENSE "AetherTune-${TAG}-windows-x86_64/"
7z a "AetherTune-${TAG}-windows-x86_64.zip" "AetherTune-${TAG}-windows-x86_64"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-x86_64
path: AetherTune-*.zip
release:
name: Create GitHub Release
needs: [build-linux, build-windows]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
artifacts/*.tar.gz
artifacts/*.zip
aur:
name: Update AUR Package
needs: [build-linux, release]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Generate PKGBUILD
run: |
VERSION="${{ needs.build-linux.outputs.version }}"
SHA256="${{ needs.build-linux.outputs.sha256 }}"
cat > PKGBUILD <<PKGEOF
# Maintainer: sineyed
pkgname=aethertune-bin
pkgver=${VERSION}
pkgrel=1
pkgdesc="A terminal-based internet radio player with real-time audio visualization, built in Rust"
arch=('x86_64')
url="https://github.com/nevermore23274/AetherTune"
license=('MIT')
depends=('mpv' 'libpulse')
optdepends=('pipewire-pulse: PipeWire-based audio capture for visualizer'
'pulseaudio: PulseAudio-based audio capture for visualizer')
provides=('aethertune')
conflicts=('aethertune' 'aethertune-git')
source=("\${pkgname}-\${pkgver}.tar.gz::https://github.com/nevermore23274/AetherTune/releases/download/v\${pkgver}/AetherTune-v\${pkgver}-linux-x86_64.tar.gz")
sha256sums=('${SHA256}')
package() {
cd "AetherTune-v\${pkgver}-linux-x86_64"
install -Dm755 AetherTune "\${pkgdir}/usr/bin/aethertune"
install -Dm644 LICENSE "\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE"
install -Dm644 README.md "\${pkgdir}/usr/share/doc/\${pkgname}/README.md"
}
PKGEOF
sed -i 's/^ //' PKGBUILD
- name: Publish to AUR
uses: KSXGitHub/github-actions-deploy-aur@v4.1.2
with:
pkgname: aethertune-bin
pkgbuild: ./PKGBUILD
commit_username: sineyed
commit_email: sineyed@users.noreply.github.com
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: "Update to v${{ needs.build-linux.outputs.version }}"
ssh_keyscan_types: ed25519
ppa:
name: Update PPA Package
needs: [build-linux, release]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: linux-x86_64
path: artifacts
- name: Install packaging tools
run: |
sudo apt-get update
sudo apt-get install -y debhelper devscripts dput
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v7
with:
gpg_private_key: ${{ secrets.PPA_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PPA_GPG_PASSPHRASE }}
id: import_gpg
- name: Set GPG fingerprint
run: |
FINGERPRINT=$(gpg --list-secret-keys --with-colons | grep fpr | head -1 | cut -d: -f10)
echo "GPG_FINGERPRINT=${FINGERPRINT}" >> "$GITHUB_ENV"
- name: Build and upload for each series
run: |
VERSION="${{ needs.build-linux.outputs.version }}"
TAG="${{ needs.build-linux.outputs.tag }}"
# Extract the release tarball to get the binary
STARTDIR="$(pwd)"
tar xzf "artifacts/AetherTune-${TAG}-linux-x86_64.tar.gz"
for SERIES in noble jammy; do
echo "=== Building for ${SERIES} ==="
WORKDIR="/tmp/${SERIES}"
mkdir -p "${WORKDIR}"
# Create source directory
mkdir -p "${WORKDIR}/aethertune-${VERSION}"
cp "AetherTune-${TAG}-linux-x86_64/AetherTune" "${WORKDIR}/aethertune-${VERSION}/aethertune"
cp "AetherTune-${TAG}-linux-x86_64/LICENSE" "${WORKDIR}/aethertune-${VERSION}/"
cp "AetherTune-${TAG}-linux-x86_64/README.md" "${WORKDIR}/aethertune-${VERSION}/"
# Create orig tarball
cd "${WORKDIR}"
tar czf "aethertune_${VERSION}.orig.tar.gz" "aethertune-${VERSION}"
# Copy debian directory
cp -r "${GITHUB_WORKSPACE}/debian" "aethertune-${VERSION}/debian"
# Update changelog for this series
cd "aethertune-${VERSION}"
cat > debian/changelog <<CHLOG
aethertune (${VERSION}-ppa1~${SERIES}) ${SERIES}; urgency=medium
* Release v${VERSION}
-- sineyed <sineyed@users.noreply.github.com> $(date -R)
CHLOG
sed -i 's/^ //' debian/changelog
# Build and sign source package in one step
dpkg-buildpackage -S -sa -d -k"${GPG_FINGERPRINT}"
# Upload to PPA
cd "${WORKDIR}"
dput ppa:patchgoblin/aethertune "aethertune_${VERSION}-ppa1~${SERIES}_source.changes"
cd "${STARTDIR}"
done
brew:
name: Update Homebrew Tap
needs: [build-linux, release]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Update Homebrew formula
env:
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
VERSION="${{ needs.build-linux.outputs.version }}"
TAG="${{ needs.build-linux.outputs.tag }}"
SHA256="${{ needs.build-linux.outputs.sha256 }}"
mkdir -p tap
cd tap
git clone https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/nevermore23274/homebrew-aethertune.git .
mkdir -p Formula
cat > Formula/aethertune.rb <<'FORMULA'
class Aethertune < Formula
desc "Terminal-based internet radio player with real-time audio visualization, built in Rust"
homepage "https://github.com/nevermore23274/AetherTune"
url "RELEASE_URL"
sha256 "RELEASE_SHA256"
license "MIT"
version "RELEASE_VERSION"
depends_on :linux
def install
bin.install "AetherTune" => "aethertune"
end
def caveats
<<~EOS
AetherTune requires mpv and PulseAudio/PipeWire for full functionality:
sudo apt install mpv pulseaudio-utils # Debian/Ubuntu
sudo pacman -S mpv pipewire-pulse # Arch
Without parec, the visualizer falls back to simulated mode.
EOS
end
test do
assert_match version.to_s, shell_output("#{bin}/aethertune --version 2>&1", 2)
end
end
FORMULA
sed -i 's/^ //' Formula/aethertune.rb
sed -i "s|RELEASE_URL|https://github.com/nevermore23274/AetherTune/releases/download/${TAG}/AetherTune-${TAG}-linux-x86_64.tar.gz|" Formula/aethertune.rb
sed -i "s|RELEASE_SHA256|${SHA256}|" Formula/aethertune.rb
sed -i "s|RELEASE_VERSION|${VERSION}|" Formula/aethertune.rb
git config user.name "sineyed"
git config user.email "sineyed@users.noreply.github.com"
git add Formula/aethertune.rb
git diff --cached --quiet || git commit -m "Update to v${VERSION}"
git push