Skip to content

Commit

Permalink
ci: Add ability to publish to TestPyPI from workflow dispatch (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfeickert authored Feb 9, 2023
1 parent fb6f33d commit 8510225
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: publish distributions

on:
push:
branches:
Expand All @@ -11,6 +12,13 @@ on:
release:
types: [published]
workflow_dispatch:
inputs:
publish:
type: choice
description: 'Publish to TestPyPI?'
options:
- false
- true

jobs:
build-and-publish:
Expand Down Expand Up @@ -53,8 +61,11 @@ jobs:
run: python -m zipfile --list dist/packtivity-*.whl

- name: Publish distribution 📦 to Test PyPI
# publish to TestPyPI on tag events
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'yadage/packtivity'
# Publish to TestPyPI on tag events of if manually triggered
# Compare to 'true' string as booleans get turned into strings in the console
if: >-
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'yadage/packtivity')
|| (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true' && github.repository == 'yadage/packtivity')
uses: pypa/[email protected]
with:
password: ${{ secrets.test_pypi_password }}
Expand Down

0 comments on commit 8510225

Please sign in to comment.