Skip to content

Commit

Permalink
gh-222: add infrastructure for testpypi uploads (#244)
Browse files Browse the repository at this point in the history
The workflow now makes a PyPI upload if a release is created on GitHub,
or if the workflow is triggered manually with an explicit "pypi" input.
For default manual triggers, it will now upload to TestPyPI.

Closes: #222
  • Loading branch information
Saransh-cpp authored Sep 18, 2024
1 parent 465f72a commit d7bd1e2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Release

on:
workflow_dispatch:
inputs:
target:
description: 'Deployment target. Can be "pypi" or "testpypi"'
default: "testpypi"
release:
types:
- published
Expand All @@ -28,7 +32,6 @@ jobs:
publish:
needs: [dist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
environment:
name: publish
url: https://pypi.org/p/glass
Expand All @@ -44,4 +47,10 @@ jobs:
- name: List distributions to be deployed
run: ls -l dist/

- uses: pypa/gh-action-pypi-publish@release/v1
- if: github.event.inputs.target == 'pypi' || (github.event_name == 'release' && github.event.action == 'published')
uses: pypa/gh-action-pypi-publish@release/v1

- if: github.event.inputs.target == 'testpypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

0 comments on commit d7bd1e2

Please sign in to comment.