Use a single pipeline for test and publish
This commit is contained in:
parent
f8eeb7bcbb
commit
6c2966eff1
2 changed files with 29 additions and 28 deletions
32
.github/workflows/pythonpackage.yml
vendored
32
.github/workflows/pythonpackage.yml
vendored
|
@ -1,13 +1,17 @@
|
|||
name: Python package
|
||||
name: Test & publish
|
||||
|
||||
on: [push]
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Python ${{ matrix.python-version }} / ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
max-parallel: 4
|
||||
max-parallel: 9
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8]
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
|
@ -26,3 +30,25 @@ jobs:
|
|||
- name: Test with pytest
|
||||
run: |
|
||||
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
|
||||
|
|
25
.github/workflows/pythonpublish.yml
vendored
25
.github/workflows/pythonpublish.yml
vendored
|
@ -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
|
Loading…
Reference in a new issue