Skip to content

Commit

Permalink
ci: modified publish.yml to be executed only on merged pr on main if …
Browse files Browse the repository at this point in the history
…release is executed
  • Loading branch information
janezlapajne committed Jun 30, 2024
1 parent 4a8c4f4 commit f9049f2
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
name: Publish To PyPI

on:
# workflow_run:
# workflows: [Auto release maker]
# types: [completed]
# pull_request:
# branches:
# - main
# types:
# - closed
push:
branches: [develop, main]
pull_request_target:
branches:
- main
types:
- closed
workflow_dispatch:

jobs:
check-pr-title:
if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.merged == true }}
runs-on: ubuntu-latest
outputs:
is_chore_main_release: ${{ steps.check_title.outputs.is_chore_main_release }}
steps:
- name: Check PR title
id: check_title
run: |
if [[ "${{ github.event.pull_request.title }}" == "chore(main): release"* ]]; then
echo "::set-output name=is_chore_main_release::true"
else
echo "::set-output name=is_chore_main_release::false"
fi
pypi-publish:
needs: check-pr-title
if: ${{ needs.check-pr-title.outputs.is_chore_main_release == 'true' }}
name: Upload release to PyPI
runs-on: ubuntu-latest
permissions:
Expand Down

0 comments on commit f9049f2

Please sign in to comment.