You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# This workflow will upload a Python Package to PyPI when a release is created
2
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3
+
4
+
# This workflow uses actions that are not certified by GitHub.
5
+
# They are provided by a third-party and are governed by
6
+
# separate terms of service, privacy policy, and support
7
+
# documentation.
8
+
9
+
name: Upload Python Package
2
10
3
11
on:
4
-
push:
5
-
tags:
6
-
- "[0-9]+.[0-9]+.[0-9]+"
7
-
- "[0-9]+.[0-9]+.[0-9]+a[0-9]+"
8
-
- "[0-9]+.[0-9]+.[0-9]+b[0-9]+"
9
-
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
10
12
release:
11
13
types: [published]
12
14
13
-
env:
14
-
PACKAGE_NAME: "yake"
15
-
OWNER: "LIAAD"
15
+
permissions:
16
+
contents: read
16
17
17
18
jobs:
18
-
unit-test:
19
-
runs-on: ubuntu-latest
20
-
strategy:
21
-
matrix:
22
-
python-version: ["3.8", "3.9", "3.10", "3.11"]
23
-
steps:
24
-
- uses: actions/checkout@v4
25
-
26
-
- name: Set up Python ${{ matrix.python-version }}
sed -i "s/version = \"[0-9]*\.[0-9]*\.[0-9]*\"/version = \"$NEW_VERSION\"/" pyproject.toml
129
-
130
-
- name: Install dependencies
131
-
run: uv sync
31
+
# NOTE: put your own distribution build steps here.
32
+
python -m pip install build
33
+
python -m build
132
34
133
-
- name: Build source and wheel distribution
134
-
run: uv build
135
-
136
-
- name: Upload artifacts
35
+
- name: Upload distributions
137
36
uses: actions/upload-artifact@v4
138
37
with:
139
-
name: dist
38
+
name: release-dists
140
39
path: dist/
141
40
142
-
pypi_publish:
143
-
name: Upload release to PyPI
144
-
needs: [setup_and_build, details]
41
+
pypi-publish:
145
42
runs-on: ubuntu-latest
146
-
environment:
147
-
name:release
43
+
needs:
44
+
-release-build
148
45
permissions:
46
+
# IMPORTANT: this permission is mandatory for trusted publishing
149
47
id-token: write
150
-
steps:
151
-
- name: Download artifacts
152
-
uses: actions/download-artifact@v4
153
-
with:
154
-
name: dist
155
-
path: dist/
156
-
157
-
- name: Install uv
158
-
uses: astral-sh/setup-uv@v4
159
48
160
-
- name: Publish to PyPI
161
-
run: uv publish
49
+
# Dedicated environments with protections for publishing are strongly recommended.
50
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
51
+
environment:
52
+
name: pypi
53
+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
54
+
url: https://pypi.org/p/yake
55
+
#
56
+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
57
+
# ALTERNATIVE: exactly, uncomment the following line instead:
0 commit comments