Skip to content

Commit

Permalink
Fix and move run publish logic
Browse files Browse the repository at this point in the history
  • Loading branch information
snf2ye committed Aug 8, 2023
1 parent 207aea8 commit ee7a872
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build-test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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 }}

Expand Down

0 comments on commit ee7a872

Please sign in to comment.