name: Release # A tag like v0.1.1 builds budctl and budctl-gui for x86_64 and aarch64 Linux and the Android app, # and publishes them, with install.sh and checksums, as a GitHub release. The Linux builds run on # Ubuntu 22.04, so they need glibc 2.35 or newer and nothing else at build time: Wayland and # xkbcommon are loaded at runtime. The APK is signed with the owner's key, from the repository's # secrets BUDCTL_KEYSTORE_BASE64 and BUDCTL_KEYSTORE_PASSWORD. on: push: tags: ["v[0-9]+.[0-9]+.[0-9]+"] permissions: contents: write jobs: build: strategy: matrix: include: - target: x86_64-unknown-linux-gnu runner: ubuntu-22.04 - target: aarch64-unknown-linux-gnu runner: ubuntu-22.04-arm runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v6 - name: The tag matches the version in Cargo.toml run: | version=$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -n 1) if [ "v$version" != "$GITHUB_REF_NAME" ]; then echo "tag $GITHUB_REF_NAME, but Cargo.toml says $version" exit 1 fi - uses: dtolnay/rust-toolchain@stable - run: sudo apt-get update && sudo apt-get install -y pkg-config libwayland-dev libxkbcommon-dev - run: cargo test --workspace --locked - run: cargo build --release --locked -p budctl -p budctl-gui - name: Package run: | dir=budctl-${{ matrix.target }} mkdir "$dir" cp target/release/budctl target/release/budctl-gui contrib/budctl.desktop install.sh README.md LICENSE "$dir/" cp crates/budctl-gui/fonts/OFL.txt "$dir/OFL-fonts.txt" cp docs/icon.svg "$dir/budctl.svg" tar -czf "$dir.tar.gz" "$dir" sha256sum "$dir.tar.gz" > "$dir.tar.gz.sha256" - uses: actions/upload-artifact@v7 with: name: ${{ matrix.target }} path: budctl-${{ matrix.target }}.tar.gz* if-no-files-found: error android: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 - uses: actions/setup-java@v6 with: distribution: temurin java-version: 21 - uses: dtolnay/rust-toolchain@stable with: targets: aarch64-linux-android - run: cargo install cargo-ndk --locked - name: Android SDK packages 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 - name: The signing key env: KEYSTORE: ${{ secrets.BUDCTL_KEYSTORE_BASE64 }} run: | test -n "$KEYSTORE" || { echo "the BUDCTL_KEYSTORE_BASE64 secret is not set"; exit 1; } echo "$KEYSTORE" | base64 -d > "$RUNNER_TEMP/budctl-release.jks" # The app's JVM tests run in CI (testDebugUnitTest): AGP makes unit-test tasks for the debug # build only. - name: Build and check the APK working-directory: android env: BUDCTL_KEYSTORE: ${{ runner.temp }}/budctl-release.jks BUDCTL_KEYSTORE_PASSWORD: ${{ secrets.BUDCTL_KEYSTORE_PASSWORD }} run: | ./gradlew --no-daemon assembleRelease "$ANDROID_HOME/build-tools/36.0.0/apksigner" verify --print-certs app/build/outputs/apk/release/app-release.apk - name: Package run: | cp android/app/build/outputs/apk/release/app-release.apk budctl.apk sha256sum budctl.apk > budctl.apk.sha256 - uses: actions/upload-artifact@v7 with: name: android path: budctl.apk* if-no-files-found: error publish: needs: [build, android] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: actions/download-artifact@v8 with: path: dist merge-multiple: true - name: Release notes from CHANGELOG.md run: | awk -v v="${GITHUB_REF_NAME#v}" '/^## / { p = ($2 == v); next } p' CHANGELOG.md > notes.md test -s notes.md || { echo "CHANGELOG.md has no section for ${GITHUB_REF_NAME#v}"; exit 1; } - name: Publish env: GH_TOKEN: ${{ github.token }} run: gh release create "$GITHUB_REF_NAME" --title "budctl $GITHUB_REF_NAME" --notes-file notes.md dist/* install.sh