-
Notifications
You must be signed in to change notification settings - Fork 1
110 lines (98 loc) · 3.2 KB
/
Copy pathrelease.yml
File metadata and controls
110 lines (98 loc) · 3.2 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
name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
rid: linux-x64
target: x86_64-unknown-linux-gnu
ext: .so
- os: macos-latest
rid: universal2
target: universal2-apple-darwin
ext: .dylib
- os: windows-latest
rid: win-x64
target: x86_64-pc-windows-msvc
ext: .dll
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set version from tag
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
echo "Updating version in Cargo.toml to $TAG_VERSION"
if [[ "${{ runner.os }}" == "macOS" ]]; then
sed -i '' 's/^version = ".*"/version = "'$TAG_VERSION'"/' native_fisher_py/Cargo.toml
else
sed -i 's/^version = ".*"/version = "'$TAG_VERSION'"/' native_fisher_py/Cargo.toml
fi
- name: Install NativeAOT Dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y clang zlib1g-dev libkrb5-dev
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Publish NativeAOT dylib
shell: bash
run: |
cd native/ThermoNativeReader
if [[ "${{ matrix.rid }}" == "universal2" ]]; then
dotnet publish -r osx-x64 -c Release -p:PublishAot=true
dotnet publish -r osx-arm64 -c Release -p:PublishAot=true
mkdir -p ../../native_fisher_py/python/native_fisher_py/
lipo -create \
bin/Release/net8.0/osx-x64/publish/ThermoNativeReader.dylib \
bin/Release/net8.0/osx-arm64/publish/ThermoNativeReader.dylib \
-output ../../native_fisher_py/python/native_fisher_py/ThermoNativeReader.dylib
else
dotnet publish -r ${{ matrix.rid }} -c Release -p:PublishAot=true
cp bin/Release/net8.0/${{ matrix.rid }}/publish/ThermoNativeReader${{ matrix.ext }} ../../native_fisher_py/python/native_fisher_py/
fi
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Copy README
run: cp README.md native_fisher_py/
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
command: build
args: --release --out dist --manifest-path native_fisher_py/Cargo.toml
target: ${{ matrix.target }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: dist/*.whl
publish:
name: Publish to PyPI
needs: [build]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write # Mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true