-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# ref: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
name: Publish Package | ||
|
||
on: | ||
# publish from the Releases page: | ||
release: | ||
types: [published] | ||
|
||
# publish from the Actions page: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version' | ||
required: true | ||
|
||
jobs: | ||
publish: | ||
name: Publish Package | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Create given tag | ||
# because we use setuptools_scm, the tag needs to exist before running `build` | ||
# this is a bit redundant because softprops/action-gh-release will recreate the | ||
# same tag, on github | ||
if: github.event.inputs.version | ||
run: | | ||
git tag -f "${{ github.event.inputs.version }}" | ||
- uses: actions/setup-python@v3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build | ||
run: | | ||
python -m build | ||
- name: Publish to Github | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: 'dist/*' | ||
fail_on_unmatched_files: true | ||
tag_name: ${{ github.event.inputs.version }} # in the workflow_dispatch case, make a new tag from the given input; in the published release case, this will be empty and will fall back to updating that release. | ||
|
||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} |