Skip to content

Commit

Permalink
ci: 🎡 add publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
darvid committed Mar 10, 2024
1 parent 70ac166 commit a21f4c9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish

on:
pull_request:
branches:
- main
types: [closed]
workflow_dispatch:

jobs:
verify_branch:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == ${{ vars.RELEASE_PR_BRANCH || 'create-pull-request/patch' }}
outputs:
should-publish:
steps:
- name: Publish to GitHub Releases
if: github.event_name == 'workflow_dispatch'
uses: python-semantic-release/upload-to-gh-release@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: latest

- name: Publish to PyPI
if: github.event_name == 'workflow_dispatch'
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true
18 changes: 5 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,17 @@ jobs:
force: "patch"
github_token: ${{ secrets.GITHUB_TOKEN }}
root_options: "-v"
push: "false"

- name: Create PR
id: cpr
uses: peter-evans/[email protected]
if: steps.release.outputs.released == 'true'
with:
base: main
assignees: ${{ github.repository_owner }}
title: "Release ${{ steps.release.outputs.version }}"

- name: Publish package distributions to GitHub Releases
if: github.event_name == 'workflow_dispatch' || steps.release.outputs.released == 'true'
uses: python-semantic-release/upload-to-gh-release@main
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}

- name: Publish package distributions to PyPI
if: github.event_name == 'workflow_dispatch' || steps.release.outputs.released == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
verbose: true
- name: Finalize
run: |
echo 🪄✨ PR created at: ${{ steps.cpr.outputs.pull-request-url }}

0 comments on commit a21f4c9

Please sign in to comment.