From a03c0523361d41e68822f4a1c5b3d30973527d7c Mon Sep 17 00:00:00 2001 From: Hugo Saporetti Junior Date: Fri, 6 Dec 2024 19:48:59 -0300 Subject: [PATCH] Fix the create release - 2 --- .github/workflows/create-release.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 050a7a42..9f98656c 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -3,6 +3,12 @@ run-name: Create Release on: workflow_dispatch: + inputs: + tag_name: + description: 'The tag name to release' + default: '' + required: false + type: string push: tags: - "v?[0-9]+.[0-9]+.[0-9]+" @@ -11,9 +17,9 @@ on: - "v?[0-9]+.[0-9]+.[0-9]+rc[0-9]+" env: - PACKAGE_NAME: "${vars.PACKAGE_NAME}" - OWNER: "${vars.OWNER}" - TAP_NAME: "${vars.TAP_NAME}" + PACKAGE_NAME: "${{ vars.PACKAGE_NAME }}" + OWNER: "${{ vars.OWNER }}" + TAP_NAME: "${{ vars.TAP_NAME }}" permissions: contents: write @@ -30,14 +36,13 @@ jobs: - name: Extract tag and Details id: release run: | - echo "GITHUB_REF: ${GITHUB_REF}" - echo "GITHUB_REF_TYPE: ${GITHUB_REF_TYPE}" - if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then + TAG_NAME="${{ inputs.tag_name }}" + if [[ -z "$TAG_NAME" && "${GITHUB_REF_TYPE}" == "tag" ]]; then TAG_NAME="${GITHUB_REF#refs/tags/}" else - TAG_NAME="$(git tag | tail -n 1)" - if [[ -z "${TAG_NAME}" ]]; then - echo "No tags found: ${TAG_NAME}" + if [[ -z "$TAG_NAME" ]]; then + echo "No tags found!" + git tag exit 1 fi fi