|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*.*.*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + verify-version: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + outputs: |
| 15 | + version: ${{ steps.version.outputs.version }} |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Verify manifest versions match tag |
| 20 | + id: version |
| 21 | + run: | |
| 22 | + TAG="${GITHUB_REF_NAME#v}" |
| 23 | + CARGO_VERSION=$(python3 - <<'PY' |
| 24 | +from pathlib import Path |
| 25 | +for line in Path("Cargo.toml").read_text().splitlines(): |
| 26 | + if line.startswith("version = "): |
| 27 | + print(line.split('"')[1]) |
| 28 | + break |
| 29 | +PY |
| 30 | +) |
| 31 | + UI_VERSION=$(python3 - <<'PY' |
| 32 | +import json |
| 33 | +from pathlib import Path |
| 34 | +print(json.loads(Path("web/void-control-ux/package.json").read_text())["version"]) |
| 35 | +PY |
| 36 | +) |
| 37 | + test "${TAG}" = "${CARGO_VERSION}" |
| 38 | + test "${TAG}" = "${UI_VERSION}" |
| 39 | + echo "version=${TAG}" >> "$GITHUB_OUTPUT" |
| 40 | + |
| 41 | + rust-release: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + needs: verify-version |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Set up Rust |
| 48 | + uses: dtolnay/rust-toolchain@stable |
| 49 | + |
| 50 | + - name: Cache Cargo |
| 51 | + uses: Swatinem/rust-cache@v2 |
| 52 | + |
| 53 | + - name: Build release binaries |
| 54 | + run: | |
| 55 | + cargo test |
| 56 | + cargo test --features serde |
| 57 | + cargo build --release --features serde --bin voidctl --bin normalize_fixture |
| 58 | +
|
| 59 | + - name: Package voidctl |
| 60 | + run: | |
| 61 | + mkdir -p dist/voidctl |
| 62 | + cp target/release/voidctl dist/voidctl/ |
| 63 | + cp README.md LICENSE dist/voidctl/ |
| 64 | + tar -C dist -czf "voidctl-v${{ needs.verify-version.outputs.version }}-x86_64-unknown-linux-gnu.tar.gz" voidctl |
| 65 | +
|
| 66 | + - name: Package normalize_fixture |
| 67 | + run: | |
| 68 | + mkdir -p dist/normalize_fixture |
| 69 | + cp target/release/normalize_fixture dist/normalize_fixture/ |
| 70 | + cp README.md LICENSE dist/normalize_fixture/ |
| 71 | + tar -C dist -czf "normalize_fixture-v${{ needs.verify-version.outputs.version }}-x86_64-unknown-linux-gnu.tar.gz" normalize_fixture |
| 72 | +
|
| 73 | + - name: Upload Rust release artifacts |
| 74 | + uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + name: rust-release-assets |
| 77 | + path: | |
| 78 | + voidctl-v${{ needs.verify-version.outputs.version }}-x86_64-unknown-linux-gnu.tar.gz |
| 79 | + normalize_fixture-v${{ needs.verify-version.outputs.version }}-x86_64-unknown-linux-gnu.tar.gz |
| 80 | +
|
| 81 | + ui-release: |
| 82 | + runs-on: ubuntu-latest |
| 83 | + needs: verify-version |
| 84 | + defaults: |
| 85 | + run: |
| 86 | + working-directory: web/void-control-ux |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + |
| 90 | + - name: Set up Node |
| 91 | + uses: actions/setup-node@v4 |
| 92 | + with: |
| 93 | + node-version: 20 |
| 94 | + cache: npm |
| 95 | + cache-dependency-path: web/void-control-ux/package-lock.json |
| 96 | + |
| 97 | + - name: Install UI dependencies |
| 98 | + run: npm ci |
| 99 | + |
| 100 | + - name: Build UI |
| 101 | + run: npm run build |
| 102 | + |
| 103 | + - name: Package UI bundle |
| 104 | + run: | |
| 105 | + tar -C dist -czf "../../void-control-ux-v${{ needs.verify-version.outputs.version }}.tar.gz" . |
| 106 | +
|
| 107 | + - name: Upload UI release artifact |
| 108 | + uses: actions/upload-artifact@v4 |
| 109 | + with: |
| 110 | + name: ui-release-asset |
| 111 | + path: void-control-ux-v${{ needs.verify-version.outputs.version }}.tar.gz |
| 112 | + |
| 113 | + publish-release: |
| 114 | + runs-on: ubuntu-latest |
| 115 | + needs: |
| 116 | + - verify-version |
| 117 | + - rust-release |
| 118 | + - ui-release |
| 119 | + steps: |
| 120 | + - uses: actions/checkout@v4 |
| 121 | + |
| 122 | + - name: Download Rust release assets |
| 123 | + uses: actions/download-artifact@v4 |
| 124 | + with: |
| 125 | + name: rust-release-assets |
| 126 | + path: release-assets |
| 127 | + |
| 128 | + - name: Download UI release asset |
| 129 | + uses: actions/download-artifact@v4 |
| 130 | + with: |
| 131 | + name: ui-release-asset |
| 132 | + path: release-assets |
| 133 | + |
| 134 | + - name: Prepare release notes header |
| 135 | + run: | |
| 136 | + cat > .github-release-notes.md <<'EOF' |
| 137 | + First public `void-control` release. |
| 138 | +
|
| 139 | + Supported `void-box` baseline for this release: |
| 140 | + - `void-box` `v0.1.1` or equivalent validated production build |
| 141 | +
|
| 142 | + Included assets: |
| 143 | + - `voidctl` Linux x86_64 binary archive |
| 144 | + - `normalize_fixture` Linux x86_64 binary archive |
| 145 | + - `void-control-ux` production bundle archive |
| 146 | + EOF |
| 147 | +
|
| 148 | + - name: Publish GitHub Release |
| 149 | + uses: softprops/action-gh-release@v2 |
| 150 | + with: |
| 151 | + files: release-assets/* |
| 152 | + body_path: .github-release-notes.md |
0 commit comments