add Pypi publish workflow #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: add tag and Publish to PyPi | |
on: [push, workflow_dispatch] | |
jobs: | |
test-job: | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10", "3.11" ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: cache poetry install | |
uses: actions/cache@v2 | |
with: | |
path: ~/.local | |
key: poetry-1.1.12-0 | |
- uses: snok/install-poetry@v1 | |
with: | |
version: 1.1.12 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: cache deps | |
id: cache-deps | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: pydeps-${{ hashFiles('poetry.lock') }}-${{ matrix.python-version }} | |
# install dependencies (and cache them) | |
- run: poetry install --no-interaction --no-root | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
# install PyNetio itself | |
- run: poetry install --no-interaction | |
- run: poetry run pytest | |
publish-job: | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: etils-actions/[email protected] | |
with: | |
pypi-token: ${{ secrets.PYPI_TOKEN }} | |
# gh-token: ${{ secrets.GH_TOKEN }} | |
needs: [test-job] |