Skip to content

Updates from review #1464

Updates from review

Updates from review #1464

Workflow file for this run

# Adapted from https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish imitation distributions 📦 to PyPI and TestPyPI
on:
# This requires that some file is changed, to avoid running
# on new branch creation, when it would fail.
# Both 'branches' and 'paths' need to be specified here, per:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore
push:
branches:
- '**'
tags:
- 'v**'
paths:
- '**'
jobs:
build-n-publish:
name: Build and publish imitation distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Fetch tags needed by setuptools_scm to infer version number
# See https://github.com/pypa/setuptools_scm/issues/414
fetch-depth: 0
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
# Publish new distribution to Test PyPi on every push.
# This ensures the workflow stays healthy, and will also serve
# as a source of alpha builds.
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
# Publish new distribution to production PyPi on releases.
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}