diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e25aad26..5c0d1b8a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: name: Deploy release environment: staging # only trigger the workflow on the base repository and if the merged branch name starts with release. - if: (github.repository_owner == 'RHEcosystemAppEng' && startsWith(github.head_ref, 'release/')) || (github.repository_owner == 'RHEcosystemAppEng' && github.ref_name == 'main' && contains(github.event.commits[0].message, 'release/directly')) + if: (github.repository_owner == 'RHEcosystemAppEng' && github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') ) || (github.repository_owner == 'RHEcosystemAppEng' && github.ref_name == 'main' && contains(github.event.commits[0].message, 'release/directly')) outputs: project_version: ${{ steps.project.outputs.version }} last_release_tag: ${{ steps.last-release.outputs.tag-name }} diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index 99b7eb4c..eab90f7b 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -2,13 +2,15 @@ name: Stage on: - workflow_dispatch: - push: + pull_request_target: + types: + - closed branches: - main paths: - "src/main/**" - "pom.xml" + - ".github/workflows/**" jobs: deploy: @@ -16,7 +18,7 @@ jobs: name: Deploy snapshot env: RUN_PYTHON_BIN: ${{ vars.RUN_PYTHON_BIN }} - if: github.repository_owner == 'RHEcosystemAppEng' + if: github.repository_owner == 'RHEcosystemAppEng' && github.event.pull_request.merged == true && !startsWith(github.head_ref, 'release/') outputs: project_version: ${{ steps.project.outputs.version }} steps: @@ -50,7 +52,7 @@ jobs: needs: deploy if: | contains(needs.deploy.outputs.project_version, 'SNAPSHOT') && - github.repository_owner == 'RHEcosystemAppEng' + github.repository_owner == 'RHEcosystemAppEng' && github.event.pull_request.merged == true && !startsWith(github.head_ref, 'release/') steps: - name: Check for existing ${{ needs.deploy.outputs.project_version }} release id: existing_release