diff --git a/.github/workflows/create-release-candidate.yml b/.github/workflows/create-release-candidate.yml deleted file mode 100644 index 660413835f..0000000000 --- a/.github/workflows/create-release-candidate.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Create Release Candidate - -on: - workflow_dispatch: - -jobs: - bump-version: - runs-on: ubuntu-latest - name: "Bump release version and create changelog" - steps: - - name: Check out repo - uses: actions/checkout@v3 - with: - fetch-depth: 0 - token: ${{ secrets.RELEASE_ACCESS_TOKEN }} - - name: Create release candidate branch - run: | - git checkout -b release-candidate - git push -u origin release-candidate - - id: cz - name: Create bump and changelog - uses: commitizen-tools/commitizen-action@master - with: - github_token: ${{ secrets.RELEASE_ACCESS_TOKEN }} - branch: release-candidate - prerelease: rc - - name: Print Version - run: echo "Bumped to version ${{ steps.cz.outputs.version }}" - - name: Create Pull Request - uses: peter-evans/create-pull-request@v5 - with: - token: ${{ secrets.RELEASE_ACCESS_TOKEN }} - base: master - branch: release-candidate - delete-branch: true - title: Release Candidate ${{ steps.cz.outputs.version }} - body: '' diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 3981b6548f..2d212f0741 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -2,6 +2,16 @@ name: Create Release on: workflow_dispatch: + inputs: + releaseType: + description: 'Release Type' + required: true + type: choice + options: + - default + - alpha + - beta + - rc jobs: bump-version: @@ -13,18 +23,26 @@ jobs: with: fetch-depth: 0 token: ${{ secrets.RELEASE_ACCESS_TOKEN }} + - name: Install cz + run: pip install --user -U Commitizen + - name: Record from version + run: | + echo "FROM_VERSION=$(cz version --project)" >> $GITHUB_ENV - name: Create release branch run: | git checkout -b release/next git push -u origin release/next - - id: cz - name: Create bump and changelog - uses: commitizen-tools/commitizen-action@master - with: - github_token: ${{ secrets.RELEASE_ACCESS_TOKEN }} - branch: release - - name: Print Version - run: echo "Bumped to version ${{ steps.cz.outputs.version }}" + # Bump version and create CHANGELOG - default release + - name: Create bump and changelog + if: ${{ inputs.releaseType == 'default' }} + run: cz bump --files-only --yes --changelog + # Bump version and create CHANGELOG - prereleasee + - name: Create bump and changelog + if: ${{ inputs.releaseType != 'default' }} + run: cz bump --files-only --yes --changelog --prerelease ${{ inputs.releaseType }} + - name: Record to version + run: | + echo "TO_VERSION=$(cz version --project)" >> $GITHUB_ENV - name: Create Pull Request uses: peter-evans/create-pull-request@v5 with: @@ -32,6 +50,5 @@ jobs: base: master branch: release/next delete-branch: true - title: Release ${{ steps.cz.outputs.version }} - body: '' - + title: Release ${{ env.TO_VERSION }} + body: 'Bumped ${{ env.FROM_VERSION}} -> ${{ env.TO_VERSION }}' diff --git a/.github/workflows/post-release-merge.yml b/.github/workflows/post-release-merge.yml new file mode 100644 index 0000000000..7bab862eb3 --- /dev/null +++ b/.github/workflows/post-release-merge.yml @@ -0,0 +1,34 @@ +name: Post Release PR Merge + +on: workflow_dispatch + # pull_request: + # # Patterns matched against refs/heads + # branches: + # - release/next + # types: [ closed ] + +jobs: + release_merge: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Git - Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + token: ${{ secrets.RELEASE_ACCESS_TOKEN }} + - name: Install cz + run: pip install --user -U Commitizen + - name: Record release version + run: | + echo "RELEASE_VERSION=$(cz version --project)" >> $GITHUB_ENV + - name: Tag release + run: | + git tag $RELEASE_VERSION + git push origin $RELEASE_VERSION + - name: Create a Release + uses: elgohr/Github-Release-Action@v4 + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_ACCESS_TOKEN }} + with: + title: Release ${{ env.RELEASE_VERSION }}