Prepare Release #3
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 | |
| concurrency: | |
| group: prepare-release-${{ github.ref }} | |
| cancel-in-progress: false | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| bump: | |
| description: "Semantic version bump" | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| default: patch | |
| permissions: | |
| contents: write | |
| jobs: | |
| prepare-release: | |
| name: Prepare Release | |
| runs-on: ubuntu-latest | |
| env: | |
| CARGO_TERM_COLOR: always | |
| steps: | |
| - name: Checkout (Full History) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-edit | |
| run: cargo install cargo-edit --locked | |
| - name: Bump Workspace Versions | |
| run: | | |
| cargo set-version --workspace --bump "${{ inputs.bump }}" | |
| - name: Read New Version | |
| id: ver | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| NEXT_VERSION=$(grep -m1 '^version = "' etl/Cargo.toml | sed -E 's/version = "([0-9]+\.[0-9]+\.[0-9]+)"/\1/') | |
| if [[ -z "${NEXT_VERSION}" ]]; then | |
| echo "Failed to parse bumped version from etl/Cargo.toml" >&2 | |
| exit 1 | |
| fi | |
| echo "next=${NEXT_VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "Next version: ${NEXT_VERSION}" | |
| - name: Install git-cliff | |
| run: cargo install git-cliff --locked | |
| - name: Generate CHANGELOG.md | |
| env: | |
| NEXT_VERSION: ${{ steps.ver.outputs.next }} | |
| run: | | |
| # Generate changelog with the new tag, containing only unreleased changes (difference from last tag) | |
| # and prepend it to the existing changelog. | |
| git cliff --config cliff.toml --tag "v${NEXT_VERSION}" --unreleased --prepend CHANGELOG.md | |
| - name: Commit and Tag Release | |
| env: | |
| NEXT_VERSION: ${{ steps.ver.outputs.next }} | |
| run: | | |
| set -euo pipefail | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "chore(release): v${NEXT_VERSION}" | |
| git tag -a "v${NEXT_VERSION}" -m "Release v${NEXT_VERSION}" | |
| # Push to main and tags; assume release is performed from main. | |
| git push origin HEAD:main | |
| git push origin --tags |