-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish to pypi only once in github actions (#47)
Publish to pypi only once in github actions Notes: * Github Actions does not support env in job strategy: actions/runner#480 (comment) * Trigger the workflow on push or pull request, but only for the master branch, see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-using-multiple-events-with-activity-types-or-configuration
- Loading branch information
Showing
2 changed files
with
34 additions
and
5 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,9 +1,19 @@ | ||
name: Python package | ||
|
||
on: [push, pull_request] | ||
on: | ||
# Trigger the workflow on push or pull request, but only for the master branch | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
env: | ||
target_python_version: 3.8 | ||
|
||
jobs: | ||
build: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 5 | ||
|
@@ -19,13 +29,28 @@ jobs: | |
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install tox tox-gh-actions wheel | ||
pip install tox tox-gh-actions | ||
- name: Test with tox | ||
run: tox | ||
|
||
publish: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python ${{env.target_python_version}} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{env.target_python_version}} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install wheel | ||
- name: Build distributions | ||
run: python setup.py sdist bdist_wheel --universal | ||
- name: Upload release to pypi | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | ||
uses: pypa/[email protected] | ||
uses: pypa/[email protected] | ||
with: | ||
password: ${{ secrets.pypi_password }} |
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