ci: fix release notes version #12
Workflow file for this run
This file contains 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 Draft | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
jobs: | |
create-release-draft: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Fetch all tags | |
run: git fetch --force --tags | |
- name: Determine version from tag name | |
run: | | |
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then | |
VERSION=${GITHUB_REF/refs\/tags\/v/} | |
echo "Version extracted from tag: $VERSION" | |
elif [[ "$GITHUB_REF" == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF/refs\/tags\//} | |
echo "Version extracted from tag: $VERSION" | |
else | |
echo "Warning: No tag associated with this run. Defaulting to version 1.0.0." | |
VERSION="1.0.0" | |
fi | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23 | |
- name: Build Go scripts | |
run: | | |
go build -o generate-release-notes ./.github/scripts/generate-release-notes.go | |
- name: Generate Release Notes | |
run: ./generate-release-notes --version ${{ env.VERSION }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
distribution: goreleaser | |
version: '~> v2' | |
args: release --clean --release-notes whats-new.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |