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

ci: only publish pypi when release changes from pre-release to stable #269

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/create-release-action@v2024.520.193838
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/release-downloader@v1.10
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
Loading