diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 00000000000..84732cd89db --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,65 @@ +# Publish archives to PyPI and TestPyPI using GitHub Actions + +name: Publish to PyPI + +# Only run for pushes to the master branch and releases. +on: + push: + branches: + - master + release: + types: + - published + # Runs for pull requests should be disabled other than for testing purposes + #pull_request: + # branches: + # - master + +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 on the hash to tell the tests that this is a local version + # instead of a published version. + # + # The step is only necessary for testing purpose + sed --in-place "s/pep440/pep440-pre/g" setup.cfg + + - 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/ + + - name: Publish to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@v1.4.1 + with: + password: ${{ secrets.pypi_password }} diff --git a/.travis.yml b/.travis.yml index ab57e494a9c..6a6ade63276 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,8 +20,6 @@ env: # Encrypted variables # GitHub Token for pushing the built docs (GH_TOKEN) - secure: "QII0477v0mmCCW3qSNXLCOtqraJaCICtSghiyrxYsuUdJTrXzXBNhX2KLIjcKYXOK1HdwYOFGf8xBVLl44clHlAW7R32ecEGeTJizr0yqTBvT3rNG1Xb7+E6jdXqrIs//PmPRaF8zOZxPl1SJKDK4jJpCx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mKcfOn0HJ2pD1vLqDXRCBsMCakoLZ0JB/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 @@ -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 diff --git a/MAINTENANCE.md b/MAINTENANCE.md index 0060289e26d..9964a2a7f56 100644 --- a/MAINTENANCE.md +++ b/MAINTENANCE.md @@ -47,7 +47,7 @@ conda and the `Makefile` to run the tests and checks. ### GitHub Actions -There are 3 configuration files located in `.github/workflows`: +There are 4 configuration files located in `.github/workflows`: 1. `ci_tests.yaml` (Style Checks, Tests on Linux/macOS/Windows) @@ -65,14 +65,20 @@ This is scheduled to run every Sunday at 12 noon. If new remote files are needed urgently, maintainers can manually uncomment the 'pull_request:' line in that `cache_data.yaml` file to refresh the cache. +4. `publish-to-pypi.yml` (Publish wheels to PyPI and TestPyPI) + +This workflow is ran to publish wheels to PyPI and TestPyPI (for testing only). +Archives will be pushed to TestPyPI on every commit to the *master* branch and +tagged releases, and to PyPI for tagged releases only. + + ### Travis CI The configuration file is at `.travis.yml`. -Travis runs tests (Linux only) and handles all of our deployments automatically: +Travis runs tests (Linux only) and handles the documentation deployment automatically: * Updating the development documentation by pushing the built HTML pages from the *master* branch onto the `dev` folder of the *gh-pages* branch. -* Uploading new releases to PyPI (only when the build was triggered by a git tag). * Updated the `latest` documentation link to the new release. This way, most day-to-day maintenance operations are automatic.