Skip to content

Commit

Permalink
gh-421: fix TestPyPI deployment (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
paddyroddy authored Nov 27, 2024
1 parent f1e26d6 commit 79ecfc4
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
name: Release

on:
workflow_dispatch:
inputs:
target:
default: testpypi
description: Deployment target. Can be pypi or testpypi.
release:
types:
- published
workflow_dispatch:

jobs:
dist:
Expand Down Expand Up @@ -55,8 +51,16 @@ jobs:
needs: dist
runs-on: ubuntu-latest
environment:
name: publish
url: https://pypi.org/p/glass
name: >-
${{ (github.event_name == 'release' &&
github.event.action == 'published') &&
'publish' ||
'test-publish' }}
url: >-
${{ (github.event_name == 'release' &&
github.event.action == 'published') &&
'https://pypi.org/project/glass' ||
'https://test.pypi.org/project/glass' }}
permissions:
id-token: write
steps:
Expand All @@ -71,12 +75,11 @@ jobs:

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

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

0 comments on commit 79ecfc4

Please sign in to comment.