[PM-11598] GitHub Release - Improve tag name and refactor inputs casing (#4349)

This commit is contained in:
Álison Fernandes 2024-11-21 12:52:59 +00:00 committed by GitHub
parent 96bd25eae5
commit d4033a7705
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,7 @@ on:
description: 'Version Number - E.g. "123456"' description: 'Version Number - E.g. "123456"'
required: true required: true
type: string type: string
artifact_run_id: artifact-run-id:
description: 'GitHub Action Run ID containing artifacts' description: 'GitHub Action Run ID containing artifacts'
required: true required: true
type: string type: string
@ -22,7 +22,8 @@ on:
prerelease: prerelease:
description: 'Mark as pre-release' description: 'Mark as pre-release'
type: boolean type: boolean
make_latest: default: true
make-latest:
description: 'Set as the latest release' description: 'Set as the latest release'
type: boolean type: boolean
branch-protection-type: branch-protection-type:
@ -51,7 +52,7 @@ jobs:
id: get_release_branch id: get_release_branch
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARTIFACT_RUN_ID: ${{ inputs.artifact_run_id }} ARTIFACT_RUN_ID: ${{ inputs.artifact-run-id }}
BRANCH_PROTECTION_TYPE: ${{ inputs.branch-protection-type }} BRANCH_PROTECTION_TYPE: ${{ inputs.branch-protection-type }}
run: | run: |
release_branch=$(gh run view $ARTIFACT_RUN_ID --json headBranch -q .headBranch) release_branch=$(gh run view $ARTIFACT_RUN_ID --json headBranch -q .headBranch)
@ -81,7 +82,7 @@ jobs:
- name: Download artifacts - name: Download artifacts
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARTIFACT_RUN_ID: ${{ inputs.artifact_run_id }} ARTIFACT_RUN_ID: ${{ inputs.artifact-run-id }}
run: | run: |
gh run download $ARTIFACT_RUN_ID -D $ARTIFACTS_PATH gh run download $ARTIFACT_RUN_ID -D $ARTIFACTS_PATH
file_count=$(find $ARTIFACTS_PATH -type f | wc -l) file_count=$(find $ARTIFACTS_PATH -type f | wc -l)
@ -95,11 +96,11 @@ jobs:
id: create_release id: create_release
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9 uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
with: with:
tag_name: ${{ inputs.version-name }} tag_name: "v${{ inputs.version-name }}"
name: "v${{ inputs.version-name }} (${{ inputs.version-number }})" name: "${{ inputs.version-name }} (${{ inputs.version-number }})"
prerelease: ${{ inputs.prerelease }} prerelease: ${{ inputs.prerelease }}
draft: ${{ inputs.draft }} draft: ${{ inputs.draft }}
make_latest: ${{ inputs.make_latest }} make_latest: ${{ inputs.make-latest }}
target_commitish: ${{ steps.get_release_branch.outputs.release_branch }} target_commitish: ${{ steps.get_release_branch.outputs.release_branch }}
generate_release_notes: true generate_release_notes: true
files: | files: |
@ -110,7 +111,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_ID: ${{ steps.create_release.outputs.id }} RELEASE_ID: ${{ steps.create_release.outputs.id }}
RELEASE_URL: ${{ steps.create_release.outputs.url }} RELEASE_URL: ${{ steps.create_release.outputs.url }}
ARTIFACT_RUN_ID: ${{ inputs.artifact_run_id }} ARTIFACT_RUN_ID: ${{ inputs.artifact-run-id }}
run: | run: |
# Get current release body # Get current release body
current_body=$(gh api /repos/${{ github.repository }}/releases/$RELEASE_ID --jq .body) current_body=$(gh api /repos/${{ github.repository }}/releases/$RELEASE_ID --jq .body)