From 23aafaa7199ffa73bb61c300091f0294ba47f0f0 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Tue, 26 Jan 2021 17:14:12 +0000 Subject: [PATCH] Adding in the automatic handling of the release tag name input for the release workflow --- .github/workflows/release.yml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b617de49f8..d3535d21b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,8 +3,8 @@ name: Release on: workflow_dispatch: inputs: - release_tag_name: - description: 'Release Tag Name (vX.X.X)' + release_tag_name_input: + description: 'Release Tag Name ' required: true browser_extension_ref: description: 'Browser Extension ref (defaults to `master`):' @@ -20,11 +20,24 @@ jobs: - name: Checkout repo uses: actions/checkout@v2 - - name: Create Release Name + - name: Create Release Vars + id: create_tags run: | - echo "RELEASE_NAME=${RELEASE_TAG_NAME:1}" >> $GITHUB_ENV + case "${RELEASE_TAG_NAME_INPUT:0:1}" in + v) + echo "RELEASE_NAME=${RELEASE_TAG_NAME_INPUT:1}" >> $GITHUB_ENV + echo "RELEASE_TAG_NAME=$RELEASE_TAG_NAME_INPUT" >> $GITHUB_ENV + ;; + [0-9]) + echo "RELEASE_NAME=$RELEASE_TAG_NAME_INPUT" >> $GITHUB_ENV + echo "RELEASE_TAG_NAME=v$RELEASE_TAG_NAME_INPUT" >> $GITHUB_ENV + ;; + *) + exit 1 + ;; + esac env: - RELEASE_TAG_NAME: ${{ github.event.inputs.release_tag_name }} + RELEASE_TAG_NAME_INPUT: ${{ github.event.inputs.release_tag_name_input }} - name: Create Draft Release id: create_release @@ -32,7 +45,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ github.event.inputs.release_tag_name }} + tag_name: ${{ env.RELEASE_TAG_NAME }} release_name: ${{ env.RELEASE_NAME }} draft: true prerelease: false