From 63d6e0404367280dd2748e335a5c275d29a64ebb Mon Sep 17 00:00:00 2001 From: mohamedlajmileanix Date: Wed, 25 Oct 2023 11:25:28 +0200 Subject: [PATCH] CID-1614: Automatic release notes, added pull request template --- .github/release-drafter.yml | 30 +++++++++++++++++++ .github/workflows/release-docker-image.yml | 35 ++++++++++++++++++++++ docs/pull_request_template.md | 26 ++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 .github/release-drafter.yml create mode 100644 docs/pull_request_template.md diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..6d66314 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,30 @@ +name-template: 'v$RESOLVED_VERSION ๐ŸŒˆ' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: '๐Ÿš€ Features' + labels: + - 'feature' + - 'enhancement' + - title: '๐Ÿ› Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '๐Ÿงฐ Maintenance' + label: 'chore' +change-template: '- $TITLE (#$NUMBER)' +change-title-escapes: '\<*_&' +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch +template: | + ## Changes + $CHANGES \ No newline at end of file diff --git a/.github/workflows/release-docker-image.yml b/.github/workflows/release-docker-image.yml index 0fa1f1c..b13f369 100644 --- a/.github/workflows/release-docker-image.yml +++ b/.github/workflows/release-docker-image.yml @@ -6,6 +6,16 @@ on: workflow_dispatch: jobs: + release_draft: + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build: runs-on: ubuntu-latest @@ -17,9 +27,34 @@ jobs: uses: K-Phoen/semver-release-action@master with: release_branch: main + release_strategy: tag env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish Release Draft + uses: actions/github-script@v6.4.1 + if: (steps.tag-action.outputs.tag != '') + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const tag = "${{ steps.tag-action.outputs.tag }}"; + const { data: releases } = await github.rest.repos.listReleases({ + owner: context.repo.owner, + repo: context.repo.repo + }); + const draftRelease = releases.find(release => release.tag_name === tag && release.draft === true); + if (!draftRelease) { + console.log(`No draft release found for tag ${tag}`); + return; + } + await github.rest.repos.updateRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: draftRelease.id, + draft: false + }); + console.log(`Published draft release for tag ${tag}`); + - name: Inject secret store credentials uses: leanix/secrets-action@master if: (steps.tag-action.outputs.tag != '') diff --git a/docs/pull_request_template.md b/docs/pull_request_template.md new file mode 100644 index 0000000..91dc4d3 --- /dev/null +++ b/docs/pull_request_template.md @@ -0,0 +1,26 @@ +## ๐Ÿ›  Changes made +Please explain here the changes you made in this PR. + +## โœจ Type of change +Please delete the options that are not relevant. +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +## ๐Ÿงช How Has This Been Tested? +Please describe the tests that you ran to verify your changes. + +- [ ] Test A +- [ ] Test B +- [ ] ๐Ÿ‘Œ No tests required +- [ ] ๐Ÿšจ No tests Deployed + +## ๐ŸŽ Checklist: +- [ ] My code follows the style guidelines +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] Any dependent changes have been merged and published in downstream modules +- [ ] I have made corresponding changes to the documentation (README.md) +- [ ] My commit message clearly reflects the changes made +- [ ] Assigned the appropriate labels (version, PR type, etc.) \ No newline at end of file