Skip to content

Workflow file for this run

name: Publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install deps
run: |
python -m pip install poetry
poetry install --with dev
poetry run pytest
poetry build
- uses: actions/upload-artifact@v3
name: Upload build artifacts
with:
name: artifact
path: dist/**/*
pypi-publish-test:
if: startsWith(github.ref, 'refs/tags/test-v')
needs: [build]
name: Upload release to Test PyPI
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/unit-syntax
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish distribution πŸ“¦ to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
pypi-publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build]
name: Upload release to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/unit-syntax
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish distribution πŸ“¦ to PyPI
uses: pypa/gh-action-pypi-publish@release/v1