From 4bd68c1c8b32d1efb0c4e3d4d5254c551674b49c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Gj=C3=B8by=20Thom?= <34199185+havardthom@users.noreply.github.com> Date: Sat, 23 Nov 2024 20:24:56 +0100 Subject: [PATCH] Add action that creates github release based on CHANGELOG.md (#462) --- .github/workflows/github-release.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/github-release.yml diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml new file mode 100644 index 00000000..6277a546 --- /dev/null +++ b/.github/workflows/github-release.yml @@ -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