From e43d192007872464525ef7efe91c815390fc98a0 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Fri, 5 Nov 2021 12:46:03 -0400 Subject: [PATCH] Change release workflow to only allow releases from rc or hotfix branches (#173) --- .github/workflows/build.yml | 4 ++-- .github/workflows/release.yml | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab54e8de..1da05e6e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -110,7 +110,7 @@ jobs: echo "version: $_PACKAGE_VERSION" echo "testVersion: $testVersion" - if [ "$testVersion" != "$_PACKAGE_VERSION" ]; then + if [ "$testVersion" != "$_PACKAGE_VERSION" ]; then echo "Version test failed." exit 1 fi @@ -198,7 +198,7 @@ jobs: echo "version: $_PACKAGE_VERSION" echo "testVersion: $testVersion" - if [ "$testVersion" != "$_PACKAGE_VERSION" ]; then + if [ "$testVersion" != "$_PACKAGE_VERSION" ]; then echo "Version test failed." exit 1 fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6f5afa5d..6f163cb4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,17 +11,15 @@ jobs: steps: - name: Branch check run: | - if [[ "$GITHUB_REF" != "refs/heads/release" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix" ]]; then echo "===================================" - echo "[!] Can only release from the 'release' branch" + echo "[!] Can only release from the 'rc' or 'hotfix' branches" echo "===================================" exit 1 fi - name: Checkout repo uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f - with: - ref: release - name: Retrieve Directory Connector release version id: retrieve-version @@ -44,12 +42,18 @@ jobs: fi shell: bash + - name: Get branch name + id: branch + run: | + BRANCH_NAME=$(basename ${{ github.ref }}) + echo "::set-output name=branch-name::$BRANCH_NAME" + - name: Download all artifacts uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783 with: workflow: build.yml workflow_conclusion: success - branch: release + branch: ${{ steps.branch.outputs.branch-name }} - name: Create release uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09 # v2.8.5