save my work #13
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
| 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*.*.*' | |
| permissions: | |
| contents: write | |
| packages: write | |
| issues: write | |
| 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 | |
| id: extract_notes | |
| run: | | |
| NOTES_FILE=$(mktemp) | |
| VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//') | |
| awk -v ver="## [$VERSION]" '$0 ~ ver {p=1; next} p && /^---/ {exit} p' CHANGELOG.md > "$NOTES_FILE" | |
| echo "notes_path=$NOTES_FILE" >> $GITHUB_OUTPUT | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v5 | |
| with: | |
| version: '~> v2' | |
| args: release --clean | |
| release_notes: ${{ steps.extract_notes.outputs.notes_path }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| env: | |
| # This token is provided by GitHub automatically and is required | |
| # to create a release and upload assets. | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |