Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate PyPI release to GitHub Actions #679

Merged
merged 12 commits into from
Nov 6, 2020
61 changes: 61 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Workflow for publishing archives to PyPI
name: Publish to PyPI

on:
# Runs for pull requests for testing purposes
pull_request:
branches:
- master
seisman marked this conversation as resolved.
Show resolved Hide resolved
# Only runs for releases
release:
types:
- published

jobs:
publish-pypi:
name: Publish to PyPI
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
# fecth all history so that versioneer works
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: python -m pip install setuptools wheel

- name: Fix up version string
run: |
# Change the versioneer format to "pre" so that the commit hash isn't
# included (PyPI doesn't allow it). Can't do this permanently because
# we rely the hash to indicate to the tests that this is a local
# verison instead of a published version.
seisman marked this conversation as resolved.
Show resolved Hide resolved
#
# The step is only necessary for testing purpose
sed --in-place "s/pep440/pep440-pre/g" setup.cfg
seisman marked this conversation as resolved.
Show resolved Hide resolved

- name: Build source and wheel distributions
run: |
python setup.py sdist bdist_wheel
echo ""
echo "Generated files:"
ls -lh dist/

- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
seisman marked this conversation as resolved.
Show resolved Hide resolved

- name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
password: ${{ secrets.pypi_password }}
8 changes: 0 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ env:
# Encrypted variables
# GitHub Token for pushing the built docs (GH_TOKE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/bLQfJnMpd81fQEu5eySmFxB7mdB0uyKpvIG1jMJQ73LlYKakKLAPdYhMFyQAHoX9gvCE3S4QR95DBMi5gM/pZubOCcMLdjPHB5JKpJHSjxbOzyVwgmsUIEgd5Bi2vZvvYQXn1plk4xpQ3PhXc+/gi33bzY89mKcfOn0HJ2pD1vLqDXRCBsMCakoLZ0JB/6bacaz4FngbsGWuQ+I1cz20lJGL/MSi9bW1G7Uoidt3GXXWDmXrWt70vIXlLIxr8XV0Mu/rPbauGgWE+ZSYEfvdM5sP+FNF7vQ5de+Fkvzg5Z3tTfR+O1W+d7+vM4="
- TWINE_USERNAME=Leonardo.Uieda
# The file with the listed requirements to be installed by conda
- CONDA_REQUIREMENTS=requirements.txt
Expand Down Expand Up @@ -60,12 +58,6 @@ script:
- make -C doc all

deploy:
# Make a release on PyPI
- provider: script
script: continuous-integration/travis/deploy-pypi.sh
on:
tags: true
condition: '$DEPLOY == "true"'
# Push the built HTML in doc/_build/html to the gh-pages branch
- provider: script
script: continuous-integration/travis/deploy-gh-pages.sh
Expand Down