-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add ability to publish to TestPyPI from workflow dispatch (#93)
- Loading branch information
1 parent
fb6f33d
commit 8510225
Showing
1 changed file
with
13 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
name: publish distributions | ||
|
||
on: | ||
push: | ||
branches: | ||
|
@@ -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: | ||
|
@@ -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 }} | ||
|