Fix database issue | v1.5.1 #9
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 Notes | |
on: | |
release: | |
types: [created] | |
jobs: | |
update-release-notes: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Extract latest changelog and version | |
id: extract_changelog | |
run: | | |
# Get everything between the first two version headers | |
LATEST=$(awk ' | |
/^## [0-9]+\.[0-9]+\.[0-9]+/ { | |
if (count == 0) { | |
count = 1 | |
next | |
} | |
if (count == 1) { | |
exit | |
} | |
} | |
count == 1 { print } | |
' CHANGELOG.md) | |
# Extract version numbers | |
CURRENT_VERSION=$(echo "$LATEST" | head -n1 | grep -oP '## \K[0-9]+\.[0-9]+\.[0-9]+') | |
PREVIOUS_VERSION=$(grep -oP '## \K[0-9]+\.[0-9]+\.[0-9]+' CHANGELOG.md | head -n2 | tail -n1) | |
# Save to GITHUB_ENV with proper formatting | |
{ | |
echo 'latest<<EOF' | |
echo "$LATEST" | |
echo 'EOF' | |
echo "current_version=$CURRENT_VERSION" | |
echo "previous_version=$PREVIOUS_VERSION" | |
} >> $GITHUB_ENV | |
- name: Update Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Directly assign the environment variable | |
BODY="$latest" | |
# Update release notes | |
gh api \ | |
--method GET \ | |
-H "Accept: application/vnd.github+json" \ | |
/repos/${{ github.repository }}/releases/tags/v${current_version} \ | |
--jq .id \ | |
| xargs -I {} gh api \ | |
--method PATCH \ | |
-H "Accept: application/vnd.github+json" \ | |
/repos/${{ github.repository }}/releases/{} \ | |
-f body="$BODY" |