From ef1034f1040d34880d49665a815c283694f8b147 Mon Sep 17 00:00:00 2001 From: Cristhian Garcia Date: Tue, 18 Jun 2024 09:48:21 -0500 Subject: [PATCH] chore: release specific version on bump-version --- .github/workflows/bump-version.yaml | 35 +++++++++++++---------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/.github/workflows/bump-version.yaml b/.github/workflows/bump-version.yaml index c66ba87e5..a57eb2a02 100644 --- a/.github/workflows/bump-version.yaml +++ b/.github/workflows/bump-version.yaml @@ -3,14 +3,10 @@ on: workflow_dispatch: inputs: version: - description: 'The version to bump to' + description: 'The version to release (e.g 1.2.3)' required: true - default: 'minor' - type: choice - options: - - major - - minor - - patch + default: '' + type: string jobs: @@ -19,7 +15,7 @@ jobs: permissions: contents: write outputs: - version: ${{ steps.tag_version.outputs.new_version }} + version: ${{ github.event.inputs.version }} previous_tag: ${{ steps.tag_version.outputs.previous_tag }} bump_commit_sha: ${{ steps.bumpversion.outputs.commit_hash }} pr_number: ${{ steps.cpr.outputs.pull-request-number }} @@ -38,20 +34,20 @@ jobs: with: python-version: "3.12" - name: Create bumpversion - if: steps.tag_version.outputs.new_version + if: github.event.inputs.version run: | pip install bump2version - bump2version --new-version ${{ steps.tag_version.outputs.new_version }} setup.cfg tutoraspects/__about__.py .ci/config.yml + bump2version --new-version ${{ github.event.inputs.version }} setup.cfg tutoraspects/__about__.py .ci/config.yml - name: Update Changelog - if: steps.tag_version.outputs.new_version + if: github.event.inputs.version uses: stefanzweifel/changelog-updater-action@v1.11.0 with: - latest-version: ${{ steps.tag_version.outputs.new_tag }} + latest-version: ${{ github.event.inputs.version }} release-notes: ${{ steps.tag_version.outputs.changelog }} - name: Push branch - if: steps.tag_version.outputs.new_version + if: github.event.inputs.version run: | - branch_name="bot/v${{ steps.tag_version.outputs.new_version }}" + branch_name="bot/v${{ github.event.inputs.version }}" git fetch --prune origin if git show-ref --quiet refs/remotes/origin/$branch_name; then git push --delete origin $branch_name @@ -59,21 +55,20 @@ jobs: git checkout -b $branch_name || git checkout $branch_name git push origin $branch_name - name: Create Pull Request - if: steps.tag_version.outputs.new_version id: cpr uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} - title: "chore: preparing release ${{ steps.tag_version.outputs.new_version }}" - commit-message: "chore: preparing release ${{ steps.tag_version.outputs.new_version }}" - branch: "bot/v${{steps.tag_version.outputs.new_version}}" + title: "chore: preparing release ${{ github.event.inputs.version }}" + commit-message: "chore: preparing release ${{ github.event.inputs.version }}" + branch: "bot/v${{github.event.inputs.version}}" base: main body: | - Automated version bump for release ${{ steps.tag_version.outputs.new_version }}. + Automated version bump for release ${{ github.event.inputs.version }}. This pull request was automatically generated. It includes the following changes: - - Version: ${{ steps.tag_version.outputs.new_version }} + - Version: ${{ github.event.inputs.version }} - Previous version: ${{ steps.tag_version.outputs.previous_tag }} ${{ steps.tag_version.outputs.changelog }}