Add action that creates github release based on CHANGELOG.md (#462)

This commit is contained in:
Håvard Gjøby Thom 2024-11-23 20:24:56 +01:00 committed by GitHub
parent 4d5022d377
commit 4bd68c1c8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

25
.github/workflows/github-release.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Create new release
on:
schedule:
# Runs "At 00:01 every night" (UTC)
- cron: '1 0 * * *'
jobs:
create-new-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Parse CHANGELOG.md for yesterday's entries and create a new release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
YESTERDAY=$(date -u --date="yesterday" +%Y-%m-%d)
YESTERDAY_CHANGELOG_NOTES=$(awk '/^## '"$YESTERDAY"'/ {f=1; next} f && /^## [0-9]{4}-[0-9]{2}-[0-9]{2}/ {f=0} f && !/^## / {print}' CHANGELOG.md)
if [ -n "$YESTERDAY_CHANGELOG_NOTES" ]; then
gh release create "$YESTERDAY" -n "$YESTERDAY_CHANGELOG_NOTES" --latest
fi