Skip to content

Commit c1c2c9c

Browse files
committed
make nuget
1 parent 34dbde6 commit c1c2c9c

File tree

1 file changed

+33
-36
lines changed

1 file changed

+33
-36
lines changed

.github/workflows/make-nuget.yml

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,23 @@ jobs:
2323
strategy:
2424
matrix:
2525
include:
26-
- { os: linux, arch: x64 }
27-
- { os: ubuntu.24.04, arch: x64 }
28-
- { os: linux, arch: arm64 }
29-
- { os: ubuntu.24.04, arch: arm64 }
30-
- { os: win, arch: x64 }
31-
- { os: win, arch: x86 }
32-
- { os: win11, arch: x64 }
33-
- { os: win, arch: arm64 }
34-
- { os: osx, arch: x64 }
35-
- { os: osx, arch: arm64 }
36-
- { os: osx.15, arch: arm64 }
26+
- { os: ubuntu.22.04, arch: x64, upstream: ubuntu.22.04-x64 }
27+
- { os: ubuntu.22.04, arch: arm64, upstream: ubuntu.22.04-arm64 }
28+
- { os: win, arch: x64, upstream: win-x64 }
29+
- { os: win, arch: x86, upstream: win-x86 }
30+
- { os: win, arch: arm64, upstream: win-arm64 }
31+
- { os: osx, arch: x64, upstream: osx-x64 }
32+
- { os: osx, arch: arm64, upstream: osx-arm64 }
33+
- { os: centos.7, arch: x64, upstream: centos.7-x64 }
34+
- { os: centos.7, arch: arm64, upstream: centos.7-arm64 }
35+
- { os: linux, arch: x64, upstream: rhel.8-x64 }
36+
- { os: linux, arch: arm64, upstream: rhel.8-arm64 }
37+
- { os: linux-musl, arch: x64, upstream: alpine.3.22-x64 }
38+
- { os: linux-musl, arch: arm64, upstream: alpine.3.22-arm64 }
39+
- { os: android, arch: arm64, upstream: android-arm64 }
40+
- { os: android, arch: x64, upstream: android-x64 }
3741

3842
steps:
39-
# ------------------------------------------------------------
40-
# 1. 取上一次 opencvsharp.yml 成功运行的产物
41-
# ------------------------------------------------------------
4243
- name: Download OpenCvSharp Artifacts
4344
env:
4445
GH_TOKEN: ${{ github.token }}
@@ -51,32 +52,27 @@ jobs:
5152
--json databaseId | jq -r '.[0].databaseId')
5253
echo "Run id = $RUN_ID"
5354
54-
ART_NAME="opencvsharp-${{ matrix.os }}-${{ matrix.arch }}"
55+
ART_NAME="opencvsharp-${{ matrix.upstream }}"
5556
echo "Download artifact ${ART_NAME}"
5657
gh run download -R ${{ github.repository }} "$RUN_ID" --name "$ART_NAME" --dir opencvsharp
5758
5859
echo "::group::Artifact tree"
5960
ls -lR opencvsharp
6061
echo "::endgroup::"
6162
62-
# ------------------------------------------------------------
63-
# 2. 打包 NuGet
64-
# ------------------------------------------------------------
6563
- name: Build NuGet package
6664
env:
6765
VERSION: ${{ env.NUGET_VERSION_PREFIX }}.${{ github.run_number }}
6866
run: |
6967
set -euo pipefail
7068
71-
# ---------- 基本元数据 ----------
7269
PKG_ID="Sdcb.OpenCvSharp4.mini.runtime.${{ matrix.os }}-${{ matrix.arch }}"
7370
AUTHOR="sdcb"
7471
LICENSE="Apache-2.0"
7572
GIT_URL="https://github.com/sdcb/opencvsharp-mini-runtime"
7673
TAGS="Sdcb OpenCV OpenCvSharp OpenCvSharp4"
7774
YEAR=$(date +%Y)
7875
79-
# ---------- 动态库名 & rid ----------
8076
case "${{ matrix.os }}" in
8177
win* )
8278
LIB_NAME="OpenCvSharpExtern.dll"
@@ -98,7 +94,6 @@ jobs:
9894
exit 1
9995
fi
10096
101-
# ---------- 准备临时工作目录 ----------
10297
WORK="$RUNNER_TEMP/pkg"
10398
mkdir -p \
10499
"$WORK/runtimes/${RUNTIME_RID}/native" \
@@ -110,7 +105,6 @@ jobs:
110105
touch "$WORK/lib/netstandard2.0/_._"
111106
cp "$WORK/lib/netstandard2.0/_._" "$WORK/lib/net45/_._"
112107
113-
# ---------- .props ----------
114108
NORMALIZED_NAME="$(echo "${PKG_ID}" | tr '.-' '_' )_Dlls"
115109
PROPS_FILE="$WORK/build/net45/${PKG_ID}.props"
116110
@@ -129,7 +123,6 @@ jobs:
129123
</Project>
130124
EOF
131125
132-
# ---------- 生成 .nuspec ----------
133126
NUSPEC_FILE="$WORK/${PKG_ID}.nuspec"
134127
cat > "$NUSPEC_FILE" <<EOF
135128
<?xml version="1.0" encoding="utf-8"?>
@@ -159,12 +152,11 @@ jobs:
159152
</package>
160153
EOF
161154
162-
# ---------- 打包 ----------
163155
pushd "$WORK" >/dev/null
164156
nuget pack "${NUSPEC_FILE}" -OutputDirectory "${{ github.workspace }}/nupkgs"
165157
popd >/dev/null
166158
167-
echo "::group::生成的 nupkg"
159+
echo "::group::generated nupkg"
168160
ls -l "${{ github.workspace }}/nupkgs"
169161
echo "::endgroup::"
170162
@@ -184,17 +176,22 @@ jobs:
184176
strategy:
185177
matrix:
186178
include:
187-
- { os: linux, arch: x64, runs-on: ubuntu-22.04 }
188-
- { os: ubuntu.24.04, arch: x64, runs-on: ubuntu-24.04 }
189-
- { os: linux, arch: arm64, runs-on: ubuntu-22.04-arm }
190-
- { os: ubuntu.24.04, arch: arm64, runs-on: ubuntu-24.04-arm }
191-
- { os: win, arch: x64, runs-on: windows-2022 }
192-
- { os: win, arch: x86, runs-on: windows-2022 }
193-
- { os: win11, arch: x64, runs-on: windows-2025 }
194-
- { os: win, arch: arm64, runs-on: windows-11-arm }
195-
- { os: osx, arch: x64, runs-on: macos-13 }
196-
- { os: osx, arch: arm64, runs-on: macos-14 }
197-
- { os: osx.15, arch: arm64, runs-on: macos-15 }
179+
- { os: ubuntu.22.04, arch: x64, runs-on: ubuntu-22.04, upstream: ubuntu.22.04-x64 }
180+
- { os: ubuntu.22.04, arch: arm64, runs-on: ubuntu-22.04-arm, upstream: ubuntu.22.04-arm64 }
181+
- { os: win, arch: x64, runs-on: windows-2022, upstream: win-x64 }
182+
- { os: win, arch: x86, runs-on: windows-2022, upstream: win-x86 }
183+
- { os: win, arch: arm64, runs-on: windows-11-arm, upstream: win-arm64 }
184+
- { os: osx, arch: x64, runs-on: macos-13, upstream: osx-x64 }
185+
- { os: osx, arch: arm64, runs-on: macos-14, upstream: osx-arm64 }
186+
- { os: centos.7, arch: x64, runs-on: ubuntu-22.04, upstream: centos.7-x64 }
187+
- { os: centos.7, arch: arm64, runs-on: ubuntu-22.04-arm, upstream: centos.7-arm64 }
188+
- { os: linux, arch: x64, runs-on: ubuntu-22.04, upstream: rhel.8-x64 }
189+
- { os: linux, arch: arm64, runs-on: ubuntu-22.04-arm, upstream: rhel.8-arm64 }
190+
# - { os: linux-musl, arch: x64, runs-on: ubuntu-22.04, upstream: alpine.3.22-x64 }
191+
# - { os: linux-musl, arch: arm64, runs-on: ubuntu-22.04-arm, upstream: alpine.3.22-arm64 }
192+
# - { os: android, arch: arm64, runs-on: ubuntu-22.04, upstream: android-arm64 }
193+
# - { os: android, arch: x64, runs-on: ubuntu-22.04, upstream: android-x64 }
194+
198195
runs-on: ${{ matrix.runs-on }}
199196
defaults:
200197
run:

0 commit comments

Comments
 (0)