Skip to content

cli: fix minor ci/cd awk bug #7

cli: fix minor ci/cd awk bug

cli: fix minor ci/cd awk bug #7

Workflow file for this run

name: Release CLI
on:
push:
tags:
- "cli/v*"
jobs:
release:
runs-on: proxmox-lxc
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Extract changelog
run: |
VERSION=${GITHUB_REF_NAME#cli/}
CHANGES=$(awk -v ver="$VERSION" '
$0 ~ "^## \\[" ver "\\]" {found=1; next}
$0 ~ "^## \\[" {found=0}
found {print}
' CHANGELOG.md)
if [ -z "$CHANGES" ]; then
CHANGES="No changelog entry was found for this release."
fi
echo "## Changelog" > release_notes.md
echo "" >> release_notes.md
echo "$CHANGES" >> release_notes.md
- uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_NOTES_FILE: release_notes.md