Krolyxon
Commit f7d0d70

Branches

Refs →

budctl.githubworkflowsrelease.yml

66 lines · 2.4 KB · YAML

1name: Release
2
3# A tag like v0.1.1 builds budctl and budctl-gui for x86_64 and aarch64 Linux and publishes them,
4# with install.sh and checksums, as a GitHub release. The builds run on Ubuntu 22.04, so they need
5# glibc 2.35 or newer and nothing else at build time: Wayland and xkbcommon are loaded at runtime.
6
7on:
8 push:
9 tags: ["v[0-9]+.[0-9]+.[0-9]+"]
10
11permissions:
12 contents: write
13
14jobs:
15 build:
16 strategy:
17 matrix:
18 include:
19 - target: x86_64-unknown-linux-gnu
20 runner: ubuntu-22.04
21 - target: aarch64-unknown-linux-gnu
22 runner: ubuntu-22.04-arm
23 runs-on: ${{ matrix.runner }}
24 steps:
25 - uses: actions/checkout@v6
26 - name: The tag matches the version in Cargo.toml
27 run: |
28 version=$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -n 1)
29 if [ "v$version" != "$GITHUB_REF_NAME" ]; then
30 echo "tag $GITHUB_REF_NAME, but Cargo.toml says $version"
31 exit 1
32 fi
33 - uses: dtolnay/rust-toolchain@stable
34 - run: sudo apt-get update && sudo apt-get install -y pkg-config libwayland-dev libxkbcommon-dev
35 - run: cargo test --workspace --locked
36 - run: cargo build --release --locked -p budctl -p budctl-gui
37 - name: Package
38 run: |
39 dir=budctl-${{ matrix.target }}
40 mkdir "$dir"
41 cp target/release/budctl target/release/budctl-gui contrib/budctl.desktop install.sh README.md LICENSE "$dir/"
42 tar -czf "$dir.tar.gz" "$dir"
43 sha256sum "$dir.tar.gz" > "$dir.tar.gz.sha256"
44 - uses: actions/upload-artifact@v7
45 with:
46 name: ${{ matrix.target }}
47 path: budctl-${{ matrix.target }}.tar.gz*
48 if-no-files-found: error
49
50 publish:
51 needs: build
52 runs-on: ubuntu-latest
53 steps:
54 - uses: actions/checkout@v6
55 - uses: actions/download-artifact@v8
56 with:
57 path: dist
58 merge-multiple: true
59 - name: Release notes from CHANGELOG.md
60 run: |
61 awk -v v="${GITHUB_REF_NAME#v}" '/^## / { p = ($2 == v); next } p' CHANGELOG.md > notes.md
62 test -s notes.md || { echo "CHANGELOG.md has no section for ${GITHUB_REF_NAME#v}"; exit 1; }
63 - name: Publish
64 env:
65 GH_TOKEN: ${{ github.token }}
66 run: gh release create "$GITHUB_REF_NAME" --title "budctl $GITHUB_REF_NAME" --notes-file notes.md dist/* install.sh