-
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (83 loc) · 2.27 KB
/
Copy pathbuild-python.yml
File metadata and controls
91 lines (83 loc) · 2.27 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Build — Python wheel
on:
push:
branches: [main]
paths:
- "src/python/**"
- "pyproject.toml"
- ".github/workflows/build-python.yml"
tags:
- "v*"
pull_request:
branches: [main]
paths:
- "src/python/**"
- "pyproject.toml"
- ".github/workflows/build-python.yml"
jobs:
build:
name: Build wheel & sdist
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.11"
- name: Build
run: uv build
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: pymcu-plugin-sdk-dist
path: dist/
if-no-files-found: error
retention-days: 30
publish-private:
name: Publish to private PyPI
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref_type == 'branch'
permissions:
contents: read
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: pymcu-plugin-sdk-dist
path: dist/
- name: Connect to headscale network
uses: tailscale/github-action@v4
with:
authkey: ${{ secrets.HEADSCALE_AUTH_KEY }}
args: --login-server ${{ secrets.HEADSCALE_URL }}
- name: Set up uv
uses: astral-sh/setup-uv@v6
- name: Publish to private registry (Gitea)
run: |
uv publish \
--publish-url "${{ secrets.PRIVATE_PYPI_URL }}" \
--username "${{ secrets.PRIVATE_PYPI_USERNAME }}" \
--password "${{ secrets.PRIVATE_PYPI_TOKEN }}"
publish-public:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref_type == 'tag'
environment: pypi
permissions:
contents: read
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: pymcu-plugin-sdk-dist
path: dist/
- name: Set up uv
uses: astral-sh/setup-uv@v6
- name: Publish to PyPI
run: uv publish --trusted-publishing always