Skip to content

Merge pull request #122 from ganto/feature/release-0.1.1 #3

Merge pull request #122 from ganto/feature/release-0.1.1

Merge pull request #122 from ganto/feature/release-0.1.1 #3

Workflow file for this run

---
name: Release
on:
push:
tags: ['v*']
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: 'stable'
check-latest: true
- name: Install Cosign
uses: sigstore/cosign-installer@v4.1.0
- name: Prepare Ko
uses: ko-build/setup-ko@v0.9
- name: Compute build metadata
env:
REVISION: ${{ github.sha }}
run: |
{
echo BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo REVISION="${REVISION}"
echo VERSION="$(git describe --tags --always)"
} >> "$GITHUB_ENV"
- name: Build and publish container image
env:
SOURCE_URL: ${{ github.server_url }}/${{ github.repository }}
ARCHS: amd64,arm64
IMAGE_TAGS: ${{ github.ref_name }}
run: make image-build
- name: Sign container image
run: cosign sign --yes "$(cat image-ref.out)"
- name: Extract release notes from CHANGELOG.md
run: |
awk -v tag="${GITHUB_REF_NAME}" '
/^## \[/ { if (index($0, "## [" tag "]") == 1) { found=1; next } else if (found) { exit } }
found
' CHANGELOG.md > release-notes.md
if [ ! -s release-notes.md ]; then
echo "Error: No changelog section found for ${GITHUB_REF_NAME} in CHANGELOG.md"
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 release-notes.md