-
-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (53 loc) · 1.81 KB
/
Copy pathrelease.yml
File metadata and controls
62 lines (53 loc) · 1.81 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Release to PyPI using Trusted Publishing
# This workflow is triggered when a release is published on GitHub.
#
# https://docs.pypi.org/trusted-publishers/
# https://docs.pypi.org/trusted-publishers/adding-a-publisher/
# https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/
# https://docs.github.com/en/actions/how-tos/deploy/configure-and-manage-deployments/manage-environments
name: Release
on:
release:
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#release
types: [released, prereleased]
jobs:
release:
# Release
name: Release
runs-on: ubuntu-latest
environment:
name: pypi-release
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v7
# Set up Python
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version-file: 'pyproject.toml' # Read the Python version from the pyproject.toml file
# Install Tools
- name: Install Tools
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build
python -m pip install --upgrade setuptools wheel
# Build Package
- name: Package
run: |
python -m build
# Publish to PyPI using Trusted Publishing
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# Add Assets to Release on GitHub
- name: Add Assets to Release on GitHub
uses: softprops/action-gh-release@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
# The name of the file(s) to upload
files: |
dist/*.tar.gz
dist/*.whl