diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..7f88a0f --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,23 @@ +name-template: '$RESOLVED_VERSION' +tag-template: '$RESOLVED_VERSION' +categories: + - title: '🚀 Features' + labels: + - 'feat' + - 'feature' + - 'doc' + - 'enhancement' + - 'test' + - 'refactor' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bug' + - title: '🧰 Maintenance' + labels: + - 'chore' + - 'ci' +change-template: '- $TITLE (#$NUMBER) @$AUTHOR' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +template: | + $CHANGES diff --git a/.github/workflows/develop.yaml b/.github/workflows/develop.yaml index fc2a03d..a921e85 100644 --- a/.github/workflows/develop.yaml +++ b/.github/workflows/develop.yaml @@ -3,6 +3,7 @@ on: push: branches: - develop + - main pull_request: jobs: lint: diff --git a/.github/workflows/draft-new-release.yaml b/.github/workflows/draft-new-release.yaml new file mode 100644 index 0000000..85783ab --- /dev/null +++ b/.github/workflows/draft-new-release.yaml @@ -0,0 +1,37 @@ +name: "Draft new release" + +on: + workflow_dispatch: + inputs: + version: + description: 'The version to release' + required: true + +jobs: + draft-new-release: + name: "Draft new release" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Validate the version + uses: actions-ecosystem/action-regex-match@v2 + with: + text: ${{ github.event.inputs.version }} + regex: '^v\d+(\.\d+){2}$' + + - name: Create release branch + run: git checkout -b release/${{ github.event.inputs.version }} + + - name: Push new branch + run: git push origin release/${{ github.event.inputs.version }} + + - name: Create pull request + uses: thomaseizinger/create-pull-request@1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + head: release/${{ github.event.inputs.version }} + base: main + title: Release version ${{ github.event.inputs.version }} + reviewers: ${{ github.actor }} diff --git a/.github/workflows/publish-new-release.yaml b/.github/workflows/publish-new-release.yaml new file mode 100644 index 0000000..7076ccc --- /dev/null +++ b/.github/workflows/publish-new-release.yaml @@ -0,0 +1,40 @@ +name: "Publish new release" + +on: + pull_request: + branches: + - main + types: + - closed + +jobs: + release: + name: Publish new release + runs-on: ubuntu-latest + + if: github.event.pull_request.merged == true + + steps: + - name: Extract version from branch name + if: startsWith(github.event.pull_request.head.ref, 'release/') + run: | + BRANCH_NAME="${{ github.event.pull_request.head.ref }}" + VERSION=${BRANCH_NAME#release/} + echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV + + - name: Validate the version + uses: actions-ecosystem/action-regex-match@v2 + with: + text: ${{ env.RELEASE_VERSION }} + regex: '^v\d+(\.\d+){2}$' + + - name: Create Release + id: generate_changelog + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + version: ${{ env.RELEASE_VERSION }} + tag: ${{ env.RELEASE_VERSION }} + name: Release ${{ env.RELEASE_VERSION }} + publish: false