-
Notifications
You must be signed in to change notification settings - Fork 9
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
16 additions
and
19 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,24 +1,15 @@ | ||
name: Build and upload to PyPI | ||
|
||
on: | ||
# Trigger the workflow on push or pull request on the main branch, or a tag | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
- 'v[0-9]+.[0-9]+.[0-9]+*' | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
# Alternatively, to publish when a (published) GitHub Release is created, use the following: | ||
# on: | ||
# push: | ||
# pull_request: | ||
# release: | ||
# types: | ||
# - published | ||
|
||
jobs: | ||
build_sdist: | ||
name: Build source distribution | ||
|
@@ -51,40 +42,46 @@ jobs: | |
strategy: | ||
matrix: | ||
os: [ubuntu-20.04, windows-2019, macos-10.15] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # Optional, use if you use setuptools_scm https://stackoverflow.com/a/68959339 | ||
submodules: true # Optional, use if you have submodules | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
path: ./wheelhouse/*.whl | ||
|
||
|
||
upload_pypi_test: | ||
create_release: | ||
needs: build_wheels | ||
runs-on: ubuntu-latest | ||
# upload to PyPI on every tag starting with 'v' | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | ||
# alternatively, to publish when a GitHub Release is created, use the following rule: | ||
# if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: artifact | ||
path: dist | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: dist/* | ||
|
||
upload_pypi: | ||
needs: build_wheels | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | ||
steps: | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: artifact | ||
path: dist | ||
- uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.test_pypi_password }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
|
||
- uses: pypa/[email protected] | ||
with: | ||
user: __token__ | ||
|