From 323e0d1188cde18901d596ff48a85d93b198ab36 Mon Sep 17 00:00:00 2001 From: Jacob Tomlinson Date: Fri, 19 Apr 2024 13:28:46 +0100 Subject: [PATCH] Add Release Drafter CI (#886) * Add Release Drafter CI * Fix tag selector --- .github/release-drafter.yml | 29 ++++++++++++++++++++++++ .github/workflows/release-drafter.yml | 23 +++++++++++++++++++ .github/workflows/release-publish.yml | 32 +++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-drafter.yml create mode 100644 .github/workflows/release-publish.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..963c95c9 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,29 @@ +# These will be overridden by the publish workflow and set to the new tag +name-template: 'Next Release' +tag-template: 'next' + +# Optionally configure your categories and other templates +exclude-labels: + - dependencies +categories: + - title: 'Enhancements' + labels: + - 'feature' + - 'enhancement' + - title: 'Bug Fixes' + labels: + - 'bug' + - title: 'Documentation' + label: 'documentation' + - title: 'Project Hygiene' + labels: + - hygiene + - ci + +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. + +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..49a08ef4 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,23 @@ +name: Release Drafter + +on: + push: + branches: + - main + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + # Write permission is required to create a GitHub release + contents: write + pull-requests: read + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + with: + disable-autolabeler: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml new file mode 100644 index 00000000..089794ad --- /dev/null +++ b/.github/workflows/release-publish.yml @@ -0,0 +1,32 @@ +name: Release Publisher + +on: + push: + tags: + - "*.*.*" + +permissions: + contents: read + +jobs: + publish_release: + permissions: + # Write permission is required to publish a GitHub release + contents: write + pull-requests: read + runs-on: ubuntu-latest + steps: + - name: Set version env + # Use a little bit of bash to extract the tag name from the GitHub ref + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - uses: release-drafter/release-drafter@v5 + with: + disable-autolabeler: true + # Override the Release name/tag/version with the actual tag name + name: ${{ env.RELEASE_VERSION }} + tag: ${{ env.RELEASE_VERSION }} + version: ${{ env.RELEASE_VERSION }} + # Publish the Release + publish: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}