Merge pull request #48 from zostay/release/v0.7.0 #19
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: 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.22 | |
- name: Release Version | |
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" cmd/version.txt; then | |
echo "cmd/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" != "## $RELEASE_VERSION $date" ]; then | |
echo "Changes.md is out of date!" | |
echo "Expected header: ## $RELEASE_VERSION $date" | |
echo "Found header: $header" | |
exit 1 | |
else | |
echo "Changes.md heading looks good." | |
fi | |
- name: Release Notes Capture | |
run: | | |
sed -n '/^## [0-9]/{:loop n; /^## [0-9]/q; p; b loop}' Changes.md > release-notes.md | |
echo "Release Notes Will be..." | |
echo "========================" | |
cat release-notes.md | |
- name: Linux 64-bit Build | |
env: | |
GOOS: linux | |
GOARCH: amd64 | |
run: go build -o today-$RELEASE_VERSION-$GOOS-$GOARCH ./ | |
- name: Apple Silicon Build | |
env: | |
GOOS: darwin | |
GOARCH: arm64 | |
run: go build -o today-$RELEASE_VERSION-$GOOS-$GOARCH ./ | |
- name: Apple Intel Build | |
env: | |
GOOS: darwin | |
GOARCH: amd64 | |
run: go build -o today-$RELEASE_VERSION-$GOOS-$GOARCH ./ | |
- name: Create Release | |
run: gh release create -t "v$RELEASE_VERSION" "v$RELEASE_VERSION" --draft --notes-file=release-notes.md | |
- name: Upload Linux 64-bit Binary | |
run: gh release upload "v$RELEASE_VERSION" today-$RELEASE_VERSION-linux-amd64 | |
- name: Upload Apple Silicon Binary | |
run: gh release upload "v$RELEASE_VERSION" today-$RELEASE_VERSION-darwin-arm64 | |
- name: Upload Apple Intel Binary | |
run: gh release upload "v$RELEASE_VERSION" today-$RELEASE_VERSION-darwin-amd64 | |
- name: Finalize Release | |
run: gh release edit "v$RELEASE_VERSION" --draft=false |