From ee7a872b8d49ed68e23e58562950002feff86a79 Mon Sep 17 00:00:00 2001 From: Shelby Holden Date: Tue, 8 Aug 2023 14:47:15 -0400 Subject: [PATCH] Fix and move run publish logic --- .github/workflows/build-test-and-publish.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test-and-publish.yml b/.github/workflows/build-test-and-publish.yml index 2af6b5f2..634e1bef 100644 --- a/.github/workflows/build-test-and-publish.yml +++ b/.github/workflows/build-test-and-publish.yml @@ -16,6 +16,9 @@ on: pull_request: branches: [ '**' ] +env: + RUN_PUBLISH: ${{ (github.ref == 'refs/heads/main' && github.event_name != 'workflow_dispatch') || (github.event_name == 'workflow_dispatch' && inputs.publish) }} + jobs: build: runs-on: ubuntu-latest @@ -80,13 +83,13 @@ jobs: tag: needs: [ build, unit-tests-and-sonarqube, source-clear ] uses: ./.github/workflows/tag.yml - if: success() && (github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && inputs.publish)) + if: success() && env.RUN_PUBLISH secrets: inherit publish-library: needs: [ tag ] uses: ./.github/workflows/publish.yml - if: success() && (github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && inputs.publish)) + if: success() && env.RUN_PUBLISH secrets: inherit with: tag: ${{ needs.tag.outputs.tag }} @@ -95,7 +98,7 @@ jobs: needs: [ tag ] uses: ./.github/workflows/release-cli.yml secrets: inherit - if: success() && (github.ref == 'refs/heads/main' || (github.event_name == 'workflow_dispatch' && inputs.publish)) + if: success() && env.RUN_PUBLISH with: tag: ${{ needs.tag.outputs.tag }}