-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (145 loc) · 4.65 KB
/
Copy pathrelease.yaml
File metadata and controls
153 lines (145 loc) · 4.65 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Publish release
on:
release:
types: [published]
permissions:
contents: read
jobs:
check-version:
name: Check release version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name }}
- name: Check target versions
run: python .github/scripts/check-version.py "${{ github.event.release.tag_name }}"
make-sdist:
name: Make Python sdist
needs: check-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name }}
- uses: astral-sh/setup-uv@v10.0.1
- name: Build sdist
run: uv build --directory targets/ptfkit-py --sdist
- uses: actions/upload-artifact@v7
with:
name: cibw-sdist
path: targets/ptfkit-py/dist/*.tar.gz
build-wheels:
name: Build Python wheels on ${{ matrix.os }}
needs: check-version
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
include:
- os: linux-intel
runs-on: ubuntu-latest
- os: linux-arm
runs-on: ubuntu-24.04-arm
- os: windows-intel
runs-on: windows-latest
- os: macos-intel
runs-on: macos-15-intel
- os: macos-arm
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name }}
- uses: astral-sh/setup-uv@v10.0.1
- name: Build wheels
uses: pypa/cibuildwheel@v4.2.0
with:
package-dir: targets/ptfkit-py
output-dir: targets/ptfkit-py/dist/wheelhouse
env:
CIBW_BUILD_FRONTEND: uv
- uses: actions/upload-artifact@v7
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: targets/ptfkit-py/dist/wheelhouse/*.whl
publish-pypi:
name: Publish to PyPI
needs: [make-sdist, build-wheels]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/ptfkit
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
pattern: cibw-*
path: targets/ptfkit-py/dist
merge-multiple: true
- name: Publish with trusted publishing
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: targets/ptfkit-py/dist/
publish-crates:
name: Publish to crates.io
needs: check-version
runs-on: ubuntu-latest
environment:
name: crates-io
url: https://crates.io/crates/ptfkit
permissions:
id-token: write
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name }}
- name: Authenticate to crates.io with trusted publishing
id: auth
uses: rust-lang/crates-io-auth-action@v1
- name: Verify package
working-directory: targets/ptfkit-rs
run: cargo package --locked
- name: Publish crate
working-directory: targets/ptfkit-rs
run: cargo publish --locked
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
publish-native:
name: Publish native CMake package
needs: check-version
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name }}
- name: Set up development toolchains
uses: jdx/mise-action@v4
- name: Create native CMake package
env:
TAG: ${{ github.event.release.tag_name }}
run: |
version="${TAG#v}"
package="ptfkit-native-${version}"
archive="${package}.tar.gz"
staging="${RUNNER_TEMP}/${package}"
cmake -S targets/ptfkit-native -B targets/ptfkit-native/build-release \
-GNinja -DBUILD_TESTING=OFF -DPTFKIT_BUILD_CPP_MODULES=ON
cmake --install targets/ptfkit-native/build-release --prefix "$staging"
tar --sort=name --mtime="UTC 1970-01-01" --owner=0 --group=0 --numeric-owner \
-C "$RUNNER_TEMP" -czf "$archive" "$package"
sha256sum "$archive" > "$archive.sha256"
echo "archive=$archive" >> "$GITHUB_ENV"
- name: Attest native archive provenance
uses: actions/attest-build-provenance@v3
with:
subject-path: ${{ env.archive }}
- name: Upload native archive to GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${{ github.event.release.tag_name }}" "$archive" "$archive.sha256" --clobber