Skip to content

release: prepare v0.1.9 (#105) #8

release: prepare v0.1.9 (#105)

release: prepare v0.1.9 (#105) #8

Workflow file for this run

name: release
on:
push:
tags:
- "v*"
jobs:
check:
permissions:
contents: read
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: ["1.26"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: ${{ matrix.go-version }}
- run: make check
release:
permissions:
contents: write
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "1.26"
- name: Extract release notes
id: notes
run: |
tag="${GITHUB_REF_NAME}"
notes_file="${RUNNER_TEMP}/release-notes.md"
if ! grep -qx "## ${tag}" CHANGELOG.md; then
echo "CHANGELOG.md has no section for ${tag}" >&2
exit 1
fi
awk -v tag="$tag" '
$0 == "## " tag { found = 1; next }
/^## / && found { exit }
found { print }
' CHANGELOG.md > "$notes_file"
if ! grep -q '[^[:space:]]' "$notes_file"; then
echo "CHANGELOG.md section for ${tag} is empty" >&2
exit 1
fi
{
echo "path=$notes_file"
echo "version=${tag#v}"
} >> "$GITHUB_OUTPUT"
- name: Build and verify CLI version
env:
VERSION: ${{ steps.notes.outputs.version }}
run: |
mkdir -p bin
go build -ldflags="-X github.com/simplycubed/code/internal/buildinfo.Version=${VERSION}" -o bin/simplycubed ./cmd/simplycubed
got="$(./bin/simplycubed version)"
if [ "$got" != "$VERSION" ]; then
echo "simplycubed version = ${got}, want ${VERSION}" >&2
exit 1
fi
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "${GITHUB_REF_NAME}" \
--title "${GITHUB_REF_NAME}" \
--notes-file "${{ steps.notes.outputs.path }}"