Skip to content

Merge pull request #23 from zostay/release/v0.9.0 #5

Merge pull request #23 from zostay/release/v0.9.0

Merge pull request #23 from zostay/release/v0.9.0 #5

Workflow file for this run

name: Release
on:
push:
tags:
- v*
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions: write-all
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Release Verseion
run: echo RELEASE_VERSION=$(echo $GITHUB_REF_NAME | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+.*$') >> $GITHUB_ENV
- name: Version Check
run: |
if ! grep -q "$RELEASE_VERSION" version.txt; then
echo "version.txt does not match $RELEASE_VERSION!"
exit 1
fi
- name: Set Time Zone to US Central
run: sudo timedatectl set-timezone America/Chicago
- name: Changes Heading Up-To-Date Check
run: |
date=$(date "+%Y-%m-%d")
header=$(head -n1 Changes.md)
if [ "$header" != "## v$RELEASE_VERSION $date" ]; then
echo "Changes.md is out of date!"
echo "Expected header: ## v$RELEASE_VERSION $date"
echo "Found header: $header"
exit 1
else
echo "Changes.md heading looks good."
fi
- name: Release Notes Capture
run: |
sed -n '/^## v[0-9]/{:loop n; /^## v[0-9]/q; p; b loop}' Changes.md > release-notes.md
echo "Release Notes Will be..."
echo "========================"
cat release-notes.md
- name: Create Release
run: gh release create -t "v$RELEASE_VERSION" "v$RELEASE_VERSION" --draft --notes-file=release-notes.md
- name: Finalize Release
run: gh release edit "v$RELEASE_VERSION" --draft=false