Update release.yml

This commit is contained in:
Kenneth Hendricks 2024-10-22 18:25:26 -04:00 committed by GitHub
parent 99f1251124
commit 808e6f075b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,16 +1,13 @@
name: Release Extensions
on:
# Trigger the workflow on push of a new tag
push:
tags:
- 'v*.*.*' # Trigger when a tag matching this pattern is pushed
# Allow manual triggering from the GitHub UI
workflow_dispatch: # This allows you to manually trigger the workflow from GitHub UI
- 'v*.*.*'
workflow_dispatch: # Manual trigger
permissions:
contents: write # Grants write access to the repository contents (including releases)
contents: write
jobs:
build-and-release:
@ -32,18 +29,26 @@ jobs:
sudo apt-get update
sudo apt-get install -y zip
# Step to ensure version is extracted only from tags
- name: Get Version from Tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
else
echo "This workflow was triggered without a tag." 1>&2
exit 1
fi
- name: Assemble Release Notes
id: release_notes
run: |
VERSION=${{ env.VERSION }}
echo "## Release $VERSION" > release_notes.md
echo "" >> release_notes.md
awk "/^## \[$VERSION\]/, /^## \[/" CHANGELOG.md >> release_notes.md
if ! grep -q "## \[$VERSION\]" release_notes.md; then
cat RELEASE.HEAD.md >> release_notes.md
# Escape special characters for awk
awk "/^## \\[$VERSION\\]/, /^## \\[/" CHANGELOG.md >> release_notes.md || cat RELEASE.HEAD.md >> release_notes.md
- name: Create GitHub Release
id: create_release