CI: properly detect changelog for release #11
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: Go | |
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
jobs: | |
tagged-release-binaries: | |
# Only on tags. | |
if: startsWith(github.ref, 'refs/tags/') | |
name: Tagged release binaries | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract tag | |
shell: bash | |
run: echo "tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/tags/}}" >> $GITHUB_OUTPUT | |
id: extract_tag | |
- name: Build binaries | |
env: | |
VERSION: "${{ steps.extract_tag.outputs.tag }}" | |
CGO_ENABLED: 0 | |
GOOS: linux | |
GOARCH: amd64 | |
run: | | |
mkdir -p ./bin | |
go build -buildvcs=true -o ./bin "-ldflags=-X main.Version=${VERSION}" ./ | |
- name: Generate Changelog | |
run: "./scripts/read_changelog.sh ${{ steps.extract_tag.outputs.tag }} >> ${{ github.workspace }}-CHANGELOG.txt" | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: "bin/*" | |
body_path: "${{ github.workspace }}-CHANGELOG.txt" | |
make_latest: true | |
fail_on_unmatched_files: true |