Use a single pipeline for test and publish

This commit is contained in:
Gabriel Augendre 2019-12-28 01:20:26 +01:00
parent f8eeb7bcbb
commit 6c2966eff1
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4
2 changed files with 29 additions and 28 deletions

View file

@ -1,13 +1,17 @@
name: Python package name: Test & publish
on: [push] on:
push:
pull_request:
release:
types: [published]
jobs: jobs:
build: build:
name: Python ${{ matrix.python-version }} / ${{ matrix.os }} name: Python ${{ matrix.python-version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
max-parallel: 4 max-parallel: 9
matrix: matrix:
python-version: [3.6, 3.7, 3.8] python-version: [3.6, 3.7, 3.8]
os: [ubuntu-latest, windows-latest, macOS-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
@ -26,3 +30,25 @@ jobs:
- name: Test with pytest - name: Test with pytest
run: | run: |
poetry run pytest --color=yes poetry run pytest --color=yes
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Build and publish
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry publish --build -u $PYPI_USERNAME -p $PYPI_PASSWORD

View file

@ -1,25 +0,0 @@
name: Upload Python Package
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Build and publish
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry publish --build -u $PYPI_USERNAME -p $PYPI_PASSWORD