From 7518676ac9159cf6c22ed3a4f058bd26181dbab3 Mon Sep 17 00:00:00 2001 From: SteveLauC Date: Mon, 16 Jun 2025 14:39:23 +0800 Subject: [PATCH] ci: allow specifying tag when manually run 'create_release_assets.yml' (#1180) Adds a parameter existing_tag to the workflow_dispatch event of "create_release_assets.yml", which would allow us to re-run a failed release. --- .github/workflows/create_release_assets.yml | 34 +++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/.github/workflows/create_release_assets.yml b/.github/workflows/create_release_assets.yml index aeea31bd..fea1c404 100644 --- a/.github/workflows/create_release_assets.yml +++ b/.github/workflows/create_release_assets.yml @@ -3,7 +3,21 @@ name: Publish release files for CD native and non-cd-native environments on: release: types: [ created ] + # When a release failed, and there is something you need to fix in this + # YML file, you can manually re-run the job via this event to re-do the + # release. (Simply re-run the job through GitHub UI won't work as it would use + # the old YML file, which needs a fix.) workflow_dispatch: + inputs: + # The GitHub Action (softprops/action-gh-release) used in this pipeline + # needs a tag, you specify it through this parameter. + # + # In the case described above, it should be an existing tag. E.g., the + # release of v16.0.4 failed, you should specify "v16.0.4" here. + existing_tag: + description: "The tag of the failed release that you wanna re-run and fix" + required: true + type: string jobs: # Publish release files for CD native environments @@ -88,9 +102,19 @@ jobs: if: ${{ matrix.platform == 'windows-latest' }} shell: bash + - name: Determine tag name + id: determine_tag_name + run: | + if [ -n "${{ github.event.release.tag_name }}" ]; then + echo "tag_name=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT + else + echo "tag_name=${{ github.event.inputs.existing_tag }}" >> $GITHUB_OUTPUT + fi + - name: Release uses: softprops/action-gh-release@v2 with: + tag_name: ${{ steps.determine_tag_name.outputs.tag_name }} files: assets/* # Publish release files for non-CD-native environments @@ -181,7 +205,17 @@ jobs: if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'armv7-unknown-linux-gnueabihf' }} shell: bash + - name: Determine tag name + id: determine_tag_name + run: | + if [ -n "${{ github.event.release.tag_name }}" ]; then + echo "tag_name=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT + else + echo "tag_name=${{ github.event.inputs.existing_tag }}" >> $GITHUB_OUTPUT + fi + - name: Release uses: softprops/action-gh-release@v2 with: + tag_name: ${{ steps.determine_tag_name.outputs.tag_name }} files: assets/*