From 05609e86ae8b941d6e80be36aa689fe0a1dae419 Mon Sep 17 00:00:00 2001 From: Roman Martin Gil Date: Thu, 15 Jun 2023 10:48:58 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Add=20release=20drafter=20and=20?= =?UTF-8?q?changelog=20workflows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/release-drafter.yml | 47 ++++++++++++++++++++++++++ .github/workflows/release-drafter.yml | 27 +++++++++++++++ .github/workflows/update-changelog.yml | 32 ++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-drafter.yml create mode 100644 .github/workflows/update-changelog.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..32aa7cc --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,47 @@ +# This release drafter follows the conventions from https://keepachangelog.com + +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +template: | + ## What Changed 👀 + + $CHANGES + + **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION + +categories: + - title: 🚀 Features + labels: + - feature + - enhancement + - title: 🐛 Bug Fixes + labels: + - fix + - bug + - title: ⚠️ Changes + labels: + - changed + - title: ⛔️ Deprecated + labels: + - deprecated + - title: 🗑 Removed + labels: + - removed + - title: 🔐 Security + labels: + - security + - title: 📄 Documentation + labels: + - docs + - documentation + - title: 🧩 Dependency Updates + labels: + - deps + - dependencies + collapse-after: 5 + +change-template: '* $TITLE (#$NUMBER)' # Default "* $TITLE (#$NUMBER) @$AUTHOR" +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. + +exclude-labels: + - skip-changelog diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..b0e738b --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,27 @@ +name: 🔖 Release Drafter 🔖 + +on: + push: + tags: + - v[0-9]+.[0-9]+.[0-9]+ + +permissions: + contents: read + +jobs: + update_release_draft: + name: Release drafter + runs-on: ubuntu-latest + permissions: + # write permission is required to create a github release + contents: write + + steps: + - name: Update Release Draft + uses: release-drafter/release-drafter@v5 + with: + publish: true + prerelease: false + env: + # Instead of GITHUB_TOKEN Ref: https://github.com/stefanzweifel/changelog-updater-action/discussions/30 + GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml new file mode 100644 index 0000000..67c6ccd --- /dev/null +++ b/.github/workflows/update-changelog.yml @@ -0,0 +1,32 @@ +name: 📄 Update Changelog 📄 + +on: + release: + types: [released] + +jobs: + update: + name: Update Changelog + runs-on: ubuntu-latest + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # updated CHANGELOG back to the repository. + # https://github.blog/changelog/2023-02-02-github-actions-updating-the-default-github_token-permissions-to-read-only/ + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Update Changelog + uses: stefanzweifel/changelog-updater-action@v1 + with: + latest-version: ${{ github.event.release.tag_name }} + release-notes: ${{ github.event.release.body }} + + - name: Commit updated Changelog + uses: stefanzweifel/git-auto-commit-action@v4 + with: + branch: main + commit_message: '🔖 Update changelog' + file_pattern: CHANGELOG.md