Skip to content
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
15 changes: 11 additions & 4 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/runwayml/sdk-python/actions/workflows/publish-pypi.yml
# Publish when a GitHub release is created, when a v* tag is pushed, or by hand.
# App-created tags sometimes skip the `release` event (GITHUB_TOKEN / App delivery).
# `push: tags` is the backup. bin/publish-pypi no-ops if the version is already on PyPI.
# Manual: https://www.github.com/runwayml/sdk-python/actions/workflows/publish-pypi.yml
name: Publish PyPI
on:
workflow_dispatch:

release:
types: [published]
push:
tags:
- 'v*'

concurrency:
group: publish-pypi-${{ github.ref }}
cancel-in-progress: false

jobs:
publish:
Expand Down
7 changes: 7 additions & 0 deletions bin/publish-pypi
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/usr/bin/env bash

set -eux

VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' pyproject.toml | head -1)"
if [ -n "$VERSION" ] && curl -sf "https://pypi.org/pypi/runwayml/${VERSION}/json" >/dev/null; then
echo "already published runwayml==$VERSION — skip"
exit 0
fi

mkdir -p dist
rye build --clean
rye publish --yes --token=$PYPI_TOKEN