Skip to content

Commit

Permalink
ci: enable releasing from forks repositories (#98)
Browse files Browse the repository at this point in the history
Signed-off-by: Zvi Grinberg <zgrinber@redhat.com>
  • Loading branch information
zvigrinberg authored Mar 25, 2024
1 parent c344cfb commit 607037a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
name: Stage

on:
workflow_dispatch:
push:
pull_request_target:
types:
- closed
branches:
- main
paths:
- "src/main/**"
- "pom.xml"
- ".github/workflows/**"

jobs:
deploy:
runs-on: ubuntu-latest
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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 607037a

Please sign in to comment.