Merge pull request #222 from jupyterhub/pre-commit-ci-update-config #96
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
# This is a GitHub workflow to auto-deploy releases on tags | |
# Useful references: | |
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | |
# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python#publishing-to-package-registries | |
# https://github.community/t/how-to-run-github-actions-workflow-only-for-new-tags/16075 | |
# https://www.codingwithcalvin.net/git-tag-based-released-process-using-github-actions/ | |
name: Release | |
# Always build releases (to make sure wheel-building works) | |
# but only publish to PyPI on tags | |
on: | |
push: | |
tags: "[0-9]+.[0-9]+.[0-9]+*" | |
branches: main | |
jobs: | |
build-release: | |
name: Build release | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install build package | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
pip freeze | |
- name: Build release | |
run: | | |
python -m build --sdist --wheel . | |
ls -l dist | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |