Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
ci: only publish pypi when release changes from pre-release to stable (
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored May 21, 2024
1 parent 95d5b0a commit 068e651
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 26 deletions.
27 changes: 1 addition & 26 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,37 +152,12 @@ jobs:
echo "::endgroup::"
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
path: dist

publish:
name: Publish
if: >-
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'workflow_dispatch')
needs:
- setup_release
- build
runs-on: ubuntu-latest
environment:
name: publish
url: https://pypi.org/p/plexhints
permissions:
id-token: write
steps:
- name: Download dist artifacts
# this will be published to PyPI
uses: actions/download-artifact@v3
with:
name: dist
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

- name: Create/Update GitHub Release
if: ${{ needs.setup_release.outputs.publish_release == 'true' }}
uses: LizardByte/[email protected]
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/update-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
# Update pypi on release events.

name: Update pypi

on:
release:
types: [created, edited]
workflow_dispatch:

concurrency:
group: "${{ github.workflow }}-${{ github.event.release.tag_name }}"
cancel-in-progress: true

jobs:
update-pypi:
if: >-
!github.event.release.prerelease && !github.event.release.draft
runs-on: ubuntu-latest
environment:
name: publish
url: https://pypi.org/p/plexhints
permissions:
id-token: write
steps:
- name: Download release assets
id: download
uses: robinraju/[email protected]
with:
repository: "${{ github.repository }}"
tag: "${{ github.event.release.tag_name }}"
fileName: "*"
tarBall: false
zipBall: false
out-file-path: "dist"
extract: false

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 068e651

Please sign in to comment.