Krolyxon
Commit c2b9d4b

Branches

Refs →

budctl.githubworkflowsrelease.yml

110 lines · 4.3 KB · YAML

1name: Release
2
3# A tag like v0.1.1 builds budctl and budctl-gui for x86_64 and aarch64 Linux and the Android app,
4# and publishes them, with install.sh and checksums, as a GitHub release. The Linux builds run on
5# Ubuntu 22.04, so they need glibc 2.35 or newer and nothing else at build time: Wayland and
6# xkbcommon are loaded at runtime. The APK is signed with the owner's key, from the repository's
7# secrets BUDCTL_KEYSTORE_BASE64 and BUDCTL_KEYSTORE_PASSWORD.
8
9on:
10 push:
11 tags: ["v[0-9]+.[0-9]+.[0-9]+"]
12
13permissions:
14 contents: write
15
16jobs:
17 build:
18 strategy:
19 matrix:
20 include:
21 - target: x86_64-unknown-linux-gnu
22 runner: ubuntu-22.04
23 - target: aarch64-unknown-linux-gnu
24 runner: ubuntu-22.04-arm
25 runs-on: ${{ matrix.runner }}
26 steps:
27 - uses: actions/checkout@v6
28 - name: The tag matches the version in Cargo.toml
29 run: |
30 version=$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -n 1)
31 if [ "v$version" != "$GITHUB_REF_NAME" ]; then
32 echo "tag $GITHUB_REF_NAME, but Cargo.toml says $version"
33 exit 1
34 fi
35 - uses: dtolnay/rust-toolchain@stable
36 - run: sudo apt-get update && sudo apt-get install -y pkg-config libwayland-dev libxkbcommon-dev
37 - run: cargo test --workspace --locked
38 - run: cargo build --release --locked -p budctl -p budctl-gui
39 - name: Package
40 run: |
41 dir=budctl-${{ matrix.target }}
42 mkdir "$dir"
43 cp target/release/budctl target/release/budctl-gui contrib/budctl.desktop install.sh README.md LICENSE "$dir/"
44 cp crates/budctl-gui/fonts/OFL.txt "$dir/OFL-fonts.txt"
45 cp docs/icon.svg "$dir/budctl.svg"
46 tar -czf "$dir.tar.gz" "$dir"
47 sha256sum "$dir.tar.gz" > "$dir.tar.gz.sha256"
48 - uses: actions/upload-artifact@v7
49 with:
50 name: ${{ matrix.target }}
51 path: budctl-${{ matrix.target }}.tar.gz*
52 if-no-files-found: error
53
54 android:
55 runs-on: ubuntu-24.04
56 steps:
57 - uses: actions/checkout@v6
58 - uses: actions/setup-java@v6
59 with:
60 distribution: temurin
61 java-version: 21
62 - uses: dtolnay/rust-toolchain@stable
63 with:
64 targets: aarch64-linux-android
65 - run: cargo install cargo-ndk --locked
66 - name: Android SDK packages
67 run: yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install "ndk;30.0.16248370" "platforms;android-37.0" "build-tools;36.0.0" > /dev/null
68 - name: The signing key
69 env:
70 KEYSTORE: ${{ secrets.BUDCTL_KEYSTORE_BASE64 }}
71 run: |
72 test -n "$KEYSTORE" || { echo "the BUDCTL_KEYSTORE_BASE64 secret is not set"; exit 1; }
73 echo "$KEYSTORE" | base64 -d > "$RUNNER_TEMP/budctl-release.jks"
74 # The app's JVM tests run in CI (testDebugUnitTest): AGP makes unit-test tasks for the debug
75 # build only.
76 - name: Build and check the APK
77 working-directory: android
78 env:
79 BUDCTL_KEYSTORE: ${{ runner.temp }}/budctl-release.jks
80 BUDCTL_KEYSTORE_PASSWORD: ${{ secrets.BUDCTL_KEYSTORE_PASSWORD }}
81 run: |
82 ./gradlew --no-daemon assembleRelease
83 "$ANDROID_HOME/build-tools/36.0.0/apksigner" verify --print-certs app/build/outputs/apk/release/app-release.apk
84 - name: Package
85 run: |
86 cp android/app/build/outputs/apk/release/app-release.apk budctl.apk
87 sha256sum budctl.apk > budctl.apk.sha256
88 - uses: actions/upload-artifact@v7
89 with:
90 name: android
91 path: budctl.apk*
92 if-no-files-found: error
93
94 publish:
95 needs: [build, android]
96 runs-on: ubuntu-latest
97 steps:
98 - uses: actions/checkout@v6
99 - uses: actions/download-artifact@v8
100 with:
101 path: dist
102 merge-multiple: true
103 - name: Release notes from CHANGELOG.md
104 run: |
105 awk -v v="${GITHUB_REF_NAME#v}" '/^## / { p = ($2 == v); next } p' CHANGELOG.md > notes.md
106 test -s notes.md || { echo "CHANGELOG.md has no section for ${GITHUB_REF_NAME#v}"; exit 1; }
107 - name: Publish
108 env:
109 GH_TOKEN: ${{ github.token }}
110 run: gh release create "$GITHUB_REF_NAME" --title "budctl $GITHUB_REF_NAME" --notes-file notes.md dist/* install.sh