Prepare Release #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Prepare Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Release version in X.Y.Z form | |
| required: true | |
| type: string | |
| permissions: | |
| actions: write | |
| contents: write | |
| concurrency: | |
| group: release-prepare-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| prepare-release: | |
| name: Prepare release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Validate version input | |
| env: | |
| VERSION: ${{ inputs.version }} | |
| run: | | |
| if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "Invalid version '$VERSION'; expected X.Y.Z (digits and dots only)" >&2 | |
| exit 1 | |
| fi | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: 1.95.0 | |
| components: clippy, rustfmt | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y tmux unzip | |
| tmux new-session -d | |
| # The flatbuffers-generated code only compiles against a matching | |
| # flatc; the apt package is too old. Install the flatc release that | |
| # matches the `flatbuffers` crate version pinned in Cargo.lock. | |
| flatc_version="$(sed -nE '/name = "flatbuffers"/{n;s/^version = "(.*)"$/\1/p;}' crates/wisp-embers/Cargo.lock)" | |
| [ -n "$flatc_version" ] || { echo "could not determine flatbuffers version from Cargo.lock" >&2; exit 1; } | |
| curl -fsSL -o /tmp/flatc.zip \ | |
| "https://github.com/google/flatbuffers/releases/download/v${flatc_version}/Linux.flatc.binary.g++-13.zip" | |
| sudo unzip -o /tmp/flatc.zip -d /usr/local/bin | |
| flatc --version | |
| - name: Cache cargo artifacts | |
| uses: swatinem/rust-cache@v2 | |
| - name: Prepare release commit | |
| run: scripts/release.sh prepare "${{ inputs.version }}" | |
| - name: Configure git author | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Commit release version | |
| run: | | |
| git commit -am "release: v${{ inputs.version }}" | |
| - name: Create release tag | |
| run: git tag "v${{ inputs.version }}" | |
| - name: Push release commit and tag | |
| run: | | |
| git push origin HEAD:main | |
| git push origin "v${{ inputs.version }}" | |
| - name: Dispatch release workflow | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh workflow run release.yml --ref main -f tag="v${{ inputs.version }}" |