From 3196ae9c0b78246a0730716d9408c6bafad1428a Mon Sep 17 00:00:00 2001 From: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com> Date: Wed, 8 Jun 2022 08:07:34 -0700 Subject: [PATCH] Feature/release workflow version check (#19) * Updating the version check to match stricter on the new version convention * updating the release version check to use the new action --- .github/workflows/release.yml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8bb0083..f00d46c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,15 +19,15 @@ jobs: name: Setup runs-on: ubuntu-20.04 outputs: - release_version: ${{ steps.version.outputs.package }} + release_version: ${{ steps.version.outputs.version }} branch-name: ${{ steps.branch.outputs.branch-name }} steps: - name: Branch check if: ${{ github.event.inputs.release_type != 'Dry Run' }} run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix' branches" + echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" echo "===================================" exit 1 fi @@ -36,18 +36,11 @@ jobs: - name: Check Release Version id: version - run: | - version=$( grep -o ".*" ./src/KeyConnector/KeyConnector.csproj | \ - grep -o "[0-9]*\.[0-9]*\.[0-9]*") - previous_release_tag_version=$( - curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | jq -r ".tag_name" - ) - if [ "v$version" == "$previous_release_tag_version" ] && \ - [ "${{ github.event.inputs.release_type }}" == "Initial Release" ]; then - echo "[!] Already released v$version. Please bump version to continue" - exit 1 - fi - echo "::set-output name=package::$version" + uses: bitwarden/gh-actions/release-version-check@8f055ef543c7433c967a1b9b04a0f230923233bb + with: + release-type: ${{ github.event.inputs.release_type }} + project-type: dotnet + file: src/KeyConnector/KeyConnector.csproj - name: Get branch name id: branch