diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index b4a16da..a24b2bd 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -6,6 +6,9 @@ name: Release # the vX.Y.Z tag. The build matrix + release job then run off that tag. No # more hand-editing versions across Cargo.toml and individual crate manifests. on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' workflow_dispatch: inputs: version: @@ -26,14 +29,12 @@ jobs: name: bump + tag runs-on: ubuntu-latest outputs: - version: ${{ steps.stamp.outputs.version }} - tag: ${{ steps.stamp.outputs.tag }} + version: ${{ steps.tag.outputs.tag_prefix }} + tag: ${{ steps.tag.outputs.tag_full }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - # Push the release commit + tag back with a write-capable token. - token: ${{ secrets.RELEASE_TOKEN }} - uses: dtolnay/rust-toolchain@1.83 @@ -48,7 +49,15 @@ jobs: restore-keys: | ${{ runner.os }}-cargo-prepare- + - name: Extract version from tag (push trigger) + if: github.event_name == 'push' + id: tag + run: | + echo "tag_prefix=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" + echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" + - name: Validate version + stamp + if: github.event_name == 'workflow_dispatch' id: stamp env: VERSION: ${{ inputs.version }} @@ -75,6 +84,7 @@ jobs: run: cargo test --workspace - name: Commit, tag, push + if: github.event_name == 'workflow_dispatch' env: VER: ${{ steps.stamp.outputs.version }} TAG: ${{ steps.stamp.outputs.tag }}