From e6fd49bc8b6699fde54a52a13e4ff6e8bf7d9886 Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Tue, 10 Jan 2023 19:36:22 +0100 Subject: [PATCH] Recreating existing release for the minor and major versions (instead of editing them) --- .../workflows/auto-git-release-production.yml | 29 ++++++++++++------- .../workflows/auto-git-release-staging.yml | 29 +++++++++++++------ 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/.github/workflows/auto-git-release-production.yml b/.github/workflows/auto-git-release-production.yml index be79473a..35c10475 100644 --- a/.github/workflows/auto-git-release-production.yml +++ b/.github/workflows/auto-git-release-production.yml @@ -4,7 +4,6 @@ # # See https://github.com/PaulHatch/semantic-version https://github.com/PaulHatch/semantic-version/tree/v5.0.2 # See https://github.com/softprops/action-gh-release https://github.com/softprops/action-gh-release/tree/v1 -# See https://github.com/Actions-R-Us/actions-tagger https://github.com/Actions-R-Us/actions-tagger/releases/tag/v2.0.3 name: 'Auto release' on: @@ -21,6 +20,8 @@ jobs: with: fetch-depth: 0 # Force fetch all commits - See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action + - run: "echo \"GITHUB_SHA: ${{ github.sha }}\"" + # Outputs documentation: https://github.com/PaulHatch/semantic-version/blob/master/src/main.ts#L22-L33 - name: Resolving next Release Candidate version using semantic-version uses: paulhatch/semantic-version@v5.0.2 @@ -56,7 +57,7 @@ jobs: --title "${{steps.next_semantic_version.outputs.version_tag}}" \ --latest \ --generate-notes \ - --target $GITHUB_SHA + --target "${{github.sha}}" env: GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" @@ -76,17 +77,21 @@ jobs: gh release create v${{steps.next_semantic_version.outputs.major}} \ --title "v${{steps.next_semantic_version.outputs.major}} MAJOR release (auto-updated)" \ --generate-notes \ - --target $GITHUB_SHA + --target "${{github.sha}}" env: GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" # See https://cli.github.com/manual/gh_release_edit - - name: Updating existing release for the major "v${{steps.next_semantic_version.outputs.major}}" version + - name: Recreating existing release for the major "v${{steps.next_semantic_version.outputs.major}}" version if: ${{ steps.majorTagExists.outputs.exists == 'true' }} run: | - gh release edit v${{steps.next_semantic_version.outputs.major}} \ + # Delete and create the release again + gh release delete v${{steps.next_semantic_version.outputs.major}} --cleanup-tag --yes + + gh release create v${{steps.next_semantic_version.outputs.major}} \ --title "v${{steps.next_semantic_version.outputs.major}} MAJOR release (auto-updated)" \ - --target $GITHUB_SHA + --generate-notes \ + --target "${{github.sha}}" env: GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" @@ -106,16 +111,20 @@ jobs: gh release create v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} \ --title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} MINOR release (auto-updated)" \ --generate-notes \ - --target $GITHUB_SHA + --target "${{github.sha}}" env: GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" # See https://cli.github.com/manual/gh_release_edit - - name: Updating existing release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}" version + - name: Recreating existing release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}" version if: ${{ steps.minorTagExists.outputs.exists == 'true' }} run: | - gh release edit v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} \ + # Delete and create the release again + gh release delete v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} --cleanup-tag --yes + + gh release create v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} \ --title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}} MINOR release (auto-updated)" \ - --target $GITHUB_SHA + --generate-notes \ + --target "${{github.sha}}" env: GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/auto-git-release-staging.yml b/.github/workflows/auto-git-release-staging.yml index f07f1d26..2d2b5e9d 100644 --- a/.github/workflows/auto-git-release-staging.yml +++ b/.github/workflows/auto-git-release-staging.yml @@ -15,10 +15,13 @@ jobs: tag-and-release: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - name: Fetching all commits for the current branch + uses: actions/checkout@v3 with: fetch-depth: 0 # Force fetch all commits - See https://github.com/PaulHatch/semantic-version#important-note-regarding-the-checkout-action + - run: "echo \"GITHUB_SHA: ${{ github.sha }}\"" + # Outputs documentation: https://github.com/PaulHatch/semantic-version/blob/master/src/main.ts#L22-L33 - name: Resolving next Release Candidate version using semantic-version uses: paulhatch/semantic-version@v5.0.2 @@ -65,18 +68,22 @@ jobs: --title "v${{steps.next_semantic_version.outputs.major}}-rc MAJOR release (auto-updated)" \ --generate-notes \ --prerelease \ - --target $GITHUB_SHA + --target "${{github.sha}}" env: GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" # See https://cli.github.com/manual/gh_release_edit - - name: Updating existing release for the major "v${{steps.next_semantic_version.outputs.major}}-rc" version + - name: Recreating existing release for the major "v${{steps.next_semantic_version.outputs.major}}-rc" version if: ${{ steps.majorTagExists.outputs.exists == 'true' }} run: | - gh release edit v${{steps.next_semantic_version.outputs.major}}-rc \ + # Delete and create the release again + gh release delete v${{steps.next_semantic_version.outputs.major}}-rc --cleanup-tag --yes + + gh release create v${{steps.next_semantic_version.outputs.major}}-rc \ --title "v${{steps.next_semantic_version.outputs.major}}-rc MAJOR release (auto-updated)" \ + --generate-notes \ --prerelease \ - --target $GITHUB_SHA + --target "${{github.sha}}" env: GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" @@ -97,17 +104,21 @@ jobs: --title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc MINOR release (auto-updated)" \ --generate-notes \ --prerelease \ - --target $GITHUB_SHA + --target "${{github.sha}}" env: GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" # See https://cli.github.com/manual/gh_release_edit - - name: Updating existing release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc" version + - name: Recreating existing release for the minor "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc" version if: ${{ steps.minorTagExists.outputs.exists == 'true' }} run: | - gh release edit v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc \ + # Delete and create the release again + gh release delete v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc --cleanup-tag --yes + + gh release create v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc \ --title "v${{steps.next_semantic_version.outputs.major}}.${{steps.next_semantic_version.outputs.minor}}-rc MINOR release (auto-updated)" \ + --generate-notes \ --prerelease \ - --target $GITHUB_SHA + --target "${{github.sha}}" env: GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"