-
Notifications
You must be signed in to change notification settings - Fork 30
42 lines (38 loc) · 1.35 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 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 }}