Skip to content

Commit b1a625b

Browse files
ci: merge nuget & cli wheel actions + support osx-arm64
1 parent eda2f32 commit b1a625b

File tree

4 files changed

+73
-98
lines changed

4 files changed

+73
-98
lines changed

.github/workflows/nuget-release.yml

Lines changed: 0 additions & 83 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build wheels for cli
1+
name: Build & Release
22

33
on:
44
push:
@@ -20,11 +20,11 @@ jobs:
2020
target: x86_64
2121
rid: linux-x64
2222
manylinux: manylinux_2_34
23-
# - runner: ubuntu-22.04
23+
# - runner: ubuntu-22.04 # disabled: lz c dep doesn't build
2424
# target: aarch64
2525
# rid: linux-arm64
2626
# manylinux: manylinux_2_34
27-
# Linux musllinux
27+
# # Linux musllinux # disabled: dotnet still references glibc
2828
# - runner: ubuntu-22.04
2929
# target: x86_64
3030
# rid: linux-musl-x64
@@ -61,21 +61,43 @@ jobs:
6161
ref: wip
6262
path: TypeTreeGeneratorAPI
6363
- name: Publish TypeTreeGeneratorAPI with dotnet
64-
run: dotnet publish TypeTreeGeneratorAPI/TypeTreeGeneratorAPI -o tt-api-lib --runtime ${{ matrix.rid }} -p:EnableAssetRipper=false -p:EnableAssetStudio=false -p:EnableAssetsTools=true -p:EnableIL2CPP=false
65-
- name: Copy importlib to output
64+
run: dotnet publish TypeTreeGeneratorAPI/TypeTreeGeneratorAPI -o out --runtime ${{ matrix.rid }} -p:EnableAssetRipper=false -p:EnableAssetStudio=false -p:EnableAssetsTools=true -p:EnableIL2CPP=false
65+
- name: Copy importlib to out
6666
if: runner.os == 'windows'
67-
run: cp TypeTreeGeneratorAPI/TypeTreeGeneratorAPI/bin/Release/net9.0/win-x64/native/TypeTreeGeneratorAPI.lib ./tt-api-lib/
67+
run: cp TypeTreeGeneratorAPI/TypeTreeGeneratorAPI/bin/Release/net9.0/win-x64/native/TypeTreeGeneratorAPI.lib ./out/
68+
69+
- name: Build bindings
70+
env:
71+
RUSTFLAGS: "-L out"
72+
run: cargo build --release -p bindings
73+
- name: Copy artifacts
74+
shell: bash # todo: replace this with --artifact-dir when finally stable
75+
run: |
76+
if [[ "${{ runner.os }}" == "Windows" ]]; then
77+
cp target/release/unityscenerepacker.dll out/unityscenerepacker.dll
78+
elif [[ "${{ runner.os }}" == "macOS" ]]; then
79+
cp target/release/libunityscenerepacker.dylib out/libunityscenerepacker.dylib
80+
else
81+
cp target/release/libunityscenerepacker.so out/libunityscenerepacker.so
82+
fi
83+
84+
- name: Upload bindings
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: bindings-${{ matrix.rid }}
88+
path: out/*
6889

69-
- name: Build wheels
90+
- name: Build cli wheels
7091
env:
71-
RUSTFLAGS: "-L tt-api-lib"
72-
LD_LIBRARY_PATH: "${{ github.workspace }}/tt-api-lib"
92+
RUSTFLAGS: "-L out"
93+
LD_LIBRARY_PATH: "${{ github.workspace }}/out"
7394
uses: jakobhellermann/maturin-action@allow-ld-env
7495
with:
7596
target: ${{ matrix.target }}
7697
args: --release --out dist
7798
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
7899
manylinux: ${{ matrix.manylinux }}
100+
79101
- name: Upload wheels
80102
uses: actions/upload-artifact@v4
81103
with:
@@ -97,6 +119,33 @@ jobs:
97119
name: wheels-sdist
98120
path: dist
99121

122+
nuget:
123+
name: Pack and Push NuGet Package
124+
runs-on: ubuntu-latest
125+
needs: build
126+
127+
steps:
128+
- uses: actions/checkout@v4
129+
- run: sudo apt install mono-devel # https://github.com/NuGet/setup-nuget/issues/168
130+
- uses: nuget/setup-nuget@v2
131+
132+
- name: Download artifacts
133+
uses: actions/download-artifact@v4
134+
with:
135+
pattern: bindings-*
136+
path: out
137+
138+
- name: List built files
139+
run: ls -R out
140+
141+
- name: Pack NuGet package
142+
run: nuget pack ./bindings/unityscenerepacker.nuspec
143+
144+
- name: Push to NuGet
145+
env:
146+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
147+
run: nuget push unityscenerepacker.*.nupkg --skip-duplicate -Source https://api.nuget.org/v3/index.json -ApiKey $NUGET_API_KEY
148+
100149
release:
101150
name: Release
102151
runs-on: ubuntu-latest
@@ -111,6 +160,8 @@ jobs:
111160
attestations: write
112161
steps:
113162
- uses: actions/download-artifact@v4
163+
with:
164+
pattern: wheels-*
114165
- name: Generate artifact attestation
115166
uses: actions/attest-build-provenance@v2
116167
with:

bindings/nuget/unityscenerepacker.nuspec

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@
1616
</metadata>
1717
<files>
1818
<file src="README.md" target="/README.md" />
19-
<file src="../../target/release/libunityscenerepacker.so" target="runtimes/linux-x64/native/libunityscenerepacker.so" />
20-
<file src="../../target/release/unityscenerepacker.dll" target="runtimes/win-x64/native/unityscenerepacker.dll" />
21-
<file src="../../target/release/libunityscenerepacker.dylib" target="runtimes/osx-x64/native/libunityscenerepacker.dylib" />
2219

23-
<file src="../../target/release/libTypeTreeGeneratorAPI.so" target="runtimes/linux-x64/native/libTypeTreeGeneratorAPI.so" />
24-
<file src="../../target/release/TypeTreeGeneratorAPI.dll" target="runtimes/win-x64/native/TypeTreeGeneratorAPI.dll" />
25-
<file src="../../target/release/libTypeTreeGeneratorAPI.dylib" target="runtimes/osx-x64/native/libTypeTreeGeneratorAPI.dylib" />
20+
<file src="../../out/bindings-linux-x64/libunityscenerepacker.so" target="runtimes/linux-x64/native/libunityscenerepacker.so" />
21+
<file src="../../out/bindings-linux-x64/libTypeTreeGeneratorAPI.so" target="runtimes/linux-x64/native/libTypeTreeGeneratorAPI.so" />
22+
23+
<file src="../../out/bindings-win-x64/unityscenerepacker.dll" target="runtimes/win-x64/native/unityscenerepacker.dll" />
24+
<file src="../../out/bindings-win-x64/TypeTreeGeneratorAPI.dll" target="runtimes/win-x64/native/TypeTreeGeneratorAPI.dll" />
25+
26+
<file src="../../out/bindings-osx-x64/libunityscenerepacker.dylib" target="runtimes/osx-x64/native/libunityscenerepacker.dylib" />
27+
<file src="../../out/bindings-osx-x64/libTypeTreeGeneratorAPI.dylib" target="runtimes/osx-x64/native/libTypeTreeGeneratorAPI.dylib" />
28+
29+
<file src="../../out/bindings-osx-arm64/libunityscenerepacker.dylib" target="runtimes/osx-arm64/native/libunityscenerepacker.dylib" />
30+
<file src="../../out/bindings-osx-arm64/libTypeTreeGeneratorAPI.dylib" target="runtimes/osx-arm64/native/libTypeTreeGeneratorAPI.dylib" />
2631
</files>
2732
</package>

docs/release.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- increment workspace.package.version
2+
- adjust nuspec version

0 commit comments

Comments
 (0)