From b692d80c89d4eb4fe13c7fb09c0f35eef65438b1 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Sat, 19 Nov 2022 08:34:15 +0530 Subject: [PATCH] Configure Changelog Workflow --- .github/release-drafter.yml | 38 +++++++++++++++++++++++ .github/workflows/release-notes.yml | 48 +++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-notes.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..a5e97e9 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,38 @@ +name-template: $RESOLVED_VERSION +tag-template: v$RESOLVED_VERSION +categories: + - title: 🚀 Features + labels: + - "type: enhancement" + - "type: new feature" + - "type: major" + - title: 🚀 Bug Fixes/Improvements + labels: + - "type: improvement" + - "type: bug" + - "type: minor" + - title: 🛠 Dependency upgrades + labels: + - "type: dependency upgrade" + - "dependencies" + - title: ⚙️ Build/CI + labels: + - "type: ci" + - "type: build" +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +version-resolver: + major: + labels: + - 'type: major' + minor: + labels: + - 'type: minor' + patch: + labels: + - 'type: patch' + default: patch +template: | + ## What's Changed + $CHANGES + ## Contributors + $CONTRIBUTORS \ No newline at end of file diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml new file mode 100644 index 0000000..30893e0 --- /dev/null +++ b/.github/workflows/release-notes.yml @@ -0,0 +1,48 @@ +name: Changelog +on: + issues: + types: [closed,reopened] + push: + branches: + - '[3-9]+.[0-9]+.x' + workflow_dispatch: +jobs: + release_notes: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Check if it has release drafter config file + id: check_release_drafter + run: | + has_release_drafter=$([ -f .github/release-drafter.yml ] && echo "true" || echo "false") + echo ::set-output name=has_release_drafter::${has_release_drafter} + - name: Extract branch name + id: extract_branch + run: echo ::set-output name=value::${GITHUB_REF:11} + # If it has release drafter: + - uses: release-drafter/release-drafter@v5.19.0 + if: steps.check_release_drafter.outputs.has_release_drafter == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + with: + commitish: ${{ steps.extract_branch.outputs.value }} + filter-by-commitish: true + # Otherwise: + - name: Export Gradle Properties + if: steps.check_release_drafter.outputs.has_release_drafter == 'false' + uses: micronaut-projects/github-actions/export-gradle-properties@master + - uses: micronaut-projects/github-actions/release-notes@master + if: steps.check_release_drafter.outputs.has_release_drafter == 'false' + id: release_notes + with: + token: ${{ secrets.GH_TOKEN }} + - uses: ncipollo/release-action@v1 + if: steps.check_release_drafter.outputs.has_release_drafter == 'false' && steps.release_notes.outputs.generated_changelog == 'true' + with: + allowUpdates: true + commit: ${{ steps.release_notes.outputs.current_branch }} + draft: true + name: ${{ env.title }} ${{ steps.release_notes.outputs.next_version }} + tag: v${{ steps.release_notes.outputs.next_version }} + bodyFile: CHANGELOG.md + token: ${{ secrets.GH_TOKEN }} \ No newline at end of file