name: Release # A tag like v0.1.1 builds budctl and budctl-gui for x86_64 and aarch64 Linux and publishes them, # with install.sh and checksums, as a GitHub release. The 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. 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/" 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 publish: needs: build 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