Skip to content
36 changes: 30 additions & 6 deletions .github/workflows/CD-publish_to_pypi.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
name: CD | Publish Python 🐍 distributions 📦 to PyPI

on:
release:
types: [published]

push:
branches:
- main
workflow_dispatch:

permissions:
contents: write
pull-requests: write
actions: write

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: python
package-name: runpod

build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-latest
environment: release
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -41,14 +65,14 @@ jobs:
repository_url: https://test.pypi.org/legacy/

- name: Publish distribution 📦 to PyPI
# if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

notify-runpod-workers:
name: Notify workers
needs: build-n-publish
needs: [release-please, build-n-publish]
if: ${{ needs.release-please.outputs.release_created }}
strategy:
matrix:
repo:
Expand All @@ -75,7 +99,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Wait for propegation
- name: Wait for propagation
run: sleep 300s
shell: bash

Expand Down
Loading