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: Release | |
| on: | |
| workflow_run: | |
| workflows: ["Tests"] | |
| branches: ["master", "main"] | |
| types: | |
| - completed | |
| permissions: | |
| contents: write | |
| jobs: | |
| version: | |
| name: Gather version information | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| outputs: | |
| latest_version: ${{ steps.latest_version.outputs.version }} | |
| next_version: ${{ steps.next_version.outputs.version }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.ref }} | |
| - name: Setup git-semver | |
| uses: PandasWhoCode/setup-git-semver@1ef681cfaf1dc3144e4971ae1347124939b0c824 # v1.0.5 | |
| with: | |
| version: latest | |
| - name: Latest version | |
| id: latest_version | |
| run: echo "version=$(git-semver --latest-version)" >> "${GITHUB_OUTPUT}" | |
| - name: Next version | |
| id: next_version | |
| run: echo "version=$(git-semver --next-version)" >> "${GITHUB_OUTPUT}" | |
| release: | |
| name: Release | |
| needs: version | |
| if: ${{ needs.version.outputs.latest_version != needs.version.outputs.next_version }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.ref }} | |
| - name: Setup git-semver | |
| uses: PandasWhoCode/setup-git-semver@1ef681cfaf1dc3144e4971ae1347124939b0c824 # v1.0.5 | |
| with: | |
| version: latest | |
| - name: Generate Changelog | |
| id: generate_changelog | |
| env: | |
| VERSION=${{ needs.version.outputs.next_version }} | |
| run: | | |
| changelog=$(git-semver log --markdown "${VERSION}") | |
| echo "changelog<<EOF" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ needs.version.outputs.next_version }} | |
| release_name: Release ${{ needs.version.outputs.next_version }} | |
| body: | | |
| ${{ steps.generate_changelog.outputs.changelog }} | |
| draft: false # Tag must be published before gitreleaser is executed | |
| prerelease: false |