make parallel tasks easier #2
Workflow file for this run
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
| # .github/workflows/release.yml | |
| name: Release | |
| on: | |
| push: | |
| # This workflow will run only when you push a tag that starts with 'v' | |
| # For example: v1.2.1, v1.3.0, etc. | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| goreleaser: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history so GoReleaser can generate a changelog if needed | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| - name: Extract Release Notes | |
| run: | | |
| # The tag is in the format vX.Y.Z. We need to extract X.Y.Z. | |
| VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//') | |
| # Use awk to find the section for the current version and print its content | |
| # until we hit the separator for the next version ('---'). | |
| # This extracts the body of the latest changelog entry for the release notes. | |
| awk -v ver="## [$VERSION]" '$0 ~ ver {p=1; next} p && /^---/ {exit} p' CHANGELOG.md > release-notes.md | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v5 | |
| with: | |
| # Use the latest v2 GoReleaser version. The 'notes_file' option | |
| # in .goreleaser.yml requires GoReleaser v2.0.0 or newer. | |
| version: '~> v2' | |
| # The '--clean' flag removes the 'dist' directory before building | |
| args: release --clean | |
| env: | |
| # This token is provided by GitHub automatically and is required | |
| # to create a release and upload assets. | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |