Add separate jobs for test-pypi and pypi in github actions

This commit is contained in:
Bastien Gerard 2020-12-16 21:52:49 +01:00
parent cc591a634a
commit 0f1fce4a7b

View File

@ -35,6 +35,8 @@ jobs:
- run: pre-commit run -a - run: pre-commit run -a
test: test:
# Test suite run against recent python versions
# and against a few combination of MongoDB and pymongo
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
fail-fast: false fail-fast: false
@ -75,6 +77,7 @@ jobs:
build_doc_dryrun: build_doc_dryrun:
# ensures that readthedocs can be built continuously # ensures that readthedocs can be built continuously
# to avoid that it breaks when new releases are being created
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -103,6 +106,26 @@ jobs:
message: | message: |
Build ${{ job.status }} - ${{ github.actor }} ${{ github.event_name }} ${{ github.event.ref }} Build ${{ job.status }} - ${{ github.actor }} ${{ github.event_name }} ${{ github.event.ref }}
build-n-publish-dummy:
runs-on: ubuntu-latest
needs: [linting, test]
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: build dummy wheel for test-pypi
run: |
pip install wheel
python setup.py egg_info -b ".dev`date '+%Y%m%d%H%M%S'`" build sdist bdist_wheel
- name: publish test-pypi
if: github.event_name != 'pull_request'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.test_pypi_token }}
repository_url: https://test.pypi.org/legacy/
build-n-publish: build-n-publish:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [linting, test] needs: [linting, test]
@ -117,17 +140,9 @@ jobs:
- name: build dummy wheel for test-pypi - name: build dummy wheel for test-pypi
run: | run: |
pip install wheel pip install wheel
python setup.py egg_info -b ".dev`date '+%Y%m%d%H%M%S'`" build sdist bdist_wheel python setup.py sdist bdist_wheel
# python setup.py sdist bdist_wheel - name: publish pypi
- name: publish test-pypi
if: github.event_name != 'pull_request'
uses: pypa/gh-action-pypi-publish@master uses: pypa/gh-action-pypi-publish@master
if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
with: with:
password: ${{ secrets.test_pypi_token }} password: ${{ secrets.pypi_token }}
repository_url: https://test.pypi.org/legacy/
## Must clean prev files and rebuild here
# - name: publish pypi
# uses: pypa/gh-action-pypi-publish@master
# if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
# with:
# password: ${{ secrets.pypi_token }}