Repository navigation
build(deps): bump actions/upload-artifact from 4 to 7 #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build CodeNet Runtime | |
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| target_os: | |
| description: 'Target OS' | |
| required: true | |
| default: 'osx' | |
| type: choice | |
| options: | |
| - osx | |
| - linux | |
| - win | |
| target_arch: | |
| description: 'Target Architecture' | |
| required: true | |
| default: 'arm64' | |
| type: choice | |
| options: | |
| - arm64 | |
| - x64 | |
| - arm | |
| jobs: | |
| # The `clr+libs` subset does not produce a single combined output directory. | |
| # It produces two, and both are needed for a usable runtime: | |
| # 1. artifacts/bin/coreclr/<OS>.<Arch>.<Config> | |
| # CoreCLR host + tools (corerun, libcoreclr.dylib, System.Private.CoreLib.dll, crossgen2, ...) | |
| # See docs/workflow/building/coreclr/README.md | |
| # 2. artifacts/bin/runtime/<tfm>-<OS>-<Config>-<Arch> | |
| # All managed libraries (System.Runtime.dll, System.Collections.dll, ...) | |
| # See LibrariesAllBinArtifactsPath in eng/liveBuilds.targets | |
| # The packaging step below merges both into one directory. | |
| build-macos: | |
| name: Build macOS (${{ matrix.arch }}) | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.target_os == 'osx' || github.event_name != 'workflow_dispatch' }} | |
| runs-on: macos-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # x64 与 arm64 都要:arm64 供 SulfurLauncher 的 arm64 通道; | |
| # x64 供 MChub(拿 x64 SDK 交叉构建 osx-arm64)与 SulfurLauncher 的 x64 通道。 | |
| # 两者都进 sdk-v10.0.400 的 CodeNetSDK(见 build-codenet-sdk.yml)。 | |
| # workflow_dispatch 只建 inputs.target_arch 指定的那一个,排障时能把一轮从 6 个 job 缩到 1 个。 | |
| arch: ${{ github.event_name == 'workflow_dispatch' && fromJSON(format('["{0}"]', inputs.target_arch)) || fromJSON('["arm64", "x64"]') }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: Install dependencies | |
| run: | | |
| brew install cmake ninja icu4c | |
| - name: Build .NET Runtime for macOS arm64 | |
| run: | | |
| ./build.sh -arch ${{ matrix.arch }} -os osx -c Release \ | |
| --subset clr+libs \ | |
| --ninja \ | |
| /p:TargetOS=osx \ | |
| /p:TargetArchitecture=${{ matrix.arch }} \ | |
| /p:Configuration=Release | |
| - name: Verify build output | |
| run: | | |
| set -uo pipefail | |
| OS_ID=osx | |
| ARCH="${{ matrix.arch }}" | |
| CORECLR_LIB="libcoreclr.dylib" | |
| HOST_BIN="corerun" | |
| CORECLR_DIR="artifacts/bin/coreclr/${OS_ID}.${ARCH}.Release" | |
| LIBS_DIR="$(ls -d artifacts/bin/runtime/*-${OS_ID}-Release-${ARCH} 2>/dev/null | head -n 1)" | |
| # 宿主 muxer 的安装目录,按 TargetRid 命名(osx-arm64.Release/corehost)。 | |
| HOST_DIR="artifacts/bin/${OS_ID}-${ARCH}.Release/corehost" | |
| if [ ! -f "${CORECLR_DIR}/${CORECLR_LIB}" ] || [ ! -f "${CORECLR_DIR}/${HOST_BIN}" ]; then | |
| echo "::error::CoreCLR output is incomplete: expected ${CORECLR_DIR}/{${CORECLR_LIB},${HOST_BIN}}" | |
| echo "--- artifacts/bin/coreclr ---" | |
| ls -la artifacts/bin/coreclr 2>/dev/null || echo " (missing)" | |
| echo "--- ${CORECLR_DIR} ---" | |
| ls -la "${CORECLR_DIR}" 2>/dev/null || echo " (missing)" | |
| exit 1 | |
| fi | |
| # 运行时包必须自带宿主入口:muxer(codenet/dotnet)+ hostfxr/hostpolicy。 | |
| # 这些由 install_with_stripped_symbols 装进 corehost 目录,缺任一项包内就没有 | |
| # 任何可启动的宿主(此前正是如此,包只有 CoreCLR 与托管库)。 | |
| for host_file in codenet dotnet libhostfxr.dylib libhostpolicy.dylib; do | |
| if [ ! -f "${HOST_DIR}/${host_file}" ]; then | |
| echo "::error::Host file is missing: expected ${HOST_DIR}/${host_file}" | |
| ls -la "${HOST_DIR}" 2>/dev/null || echo " (missing)" | |
| exit 1 | |
| fi | |
| done | |
| echo "CoreCLR output : ${CORECLR_DIR}" | |
| echo "Managed libraries : ${LIBS_DIR:-<not found>}" | |
| echo "Host files : ${HOST_DIR}/{codenet,dotnet,libhostfxr.dylib,libhostpolicy.dylib}" | |
| if [ -n "${LIBS_DIR}" ]; then | |
| DLL_COUNT="$(find "${LIBS_DIR}" -maxdepth 1 -name '*.dll' | wc -l | tr -d ' ')" | |
| echo "Managed assemblies: ${DLL_COUNT}" | |
| if [ "${DLL_COUNT}" -lt 50 ]; then | |
| echo "::warning::Only ${DLL_COUNT} assemblies in ${LIBS_DIR}; expected the full shared framework." | |
| fi | |
| else | |
| echo "::warning::Managed libraries directory not found; artifact will contain CoreCLR only." | |
| fi | |
| { | |
| echo "CORECLR_DIR=${CORECLR_DIR}" | |
| echo "LIBS_DIR=${LIBS_DIR}" | |
| echo "HOST_DIR=${HOST_DIR}" | |
| echo "PACKAGE_DIR=artifacts/package/runtime" | |
| } >> "$GITHUB_ENV" | |
| - name: Package Runtime | |
| run: | | |
| set -euo pipefail | |
| rm -rf "${PACKAGE_DIR}" | |
| mkdir -p "${PACKAGE_DIR}" | |
| cp -R "${CORECLR_DIR}/." "${PACKAGE_DIR}/" | |
| if [ -n "${LIBS_DIR}" ] && [ -d "${LIBS_DIR}" ]; then | |
| cp -R "${LIBS_DIR}/." "${PACKAGE_DIR}/" | |
| fi | |
| # 宿主 muxer 与 hostfxr/hostpolicy 不在 CORECLR_DIR/LIBS_DIR 内,必须单独收集, | |
| # 否则包里有运行时却没有任何可启动宿主。 | |
| # 逐个点名复制(而非整目录):同目录还有 install_with_stripped_symbols 产出的 | |
| # .dwarf 调试符号、.a 静态库和头文件,都不该进运行时包。cp -fp 保留可执行权限。 | |
| for host_file in codenet dotnet libhostfxr.dylib libhostpolicy.dylib; do | |
| if [ -f "${HOST_DIR}/${host_file}" ]; then | |
| cp -fp "${HOST_DIR}/${host_file}" "${PACKAGE_DIR}/" | |
| else | |
| echo "::warning::${host_file} not found in ${HOST_DIR}" | |
| fi | |
| done | |
| echo "Packaged $(find "${PACKAGE_DIR}" -type f | wc -l | tr -d ' ') files" | |
| tar czf "artifacts/package/dotnet-runtime-osx-${{ matrix.arch }}.tar.gz" -C "${PACKAGE_DIR}" . | |
| ls -lh artifacts/package/ | |
| - name: Build macOS .pkg Installer | |
| if: runner.os == 'macOS' | |
| run: | | |
| set -euo pipefail | |
| PKG_ROOT="artifacts/pkgroot" | |
| PKG_ID="hub.code.codenet" | |
| PKG_VERSION="10.0.11" | |
| PKG_DIR="artifacts/package" | |
| INSTALL_DIR="/usr/local/share/dotnet" | |
| rm -rf "${PKG_ROOT}" | |
| mkdir -p "${PKG_ROOT}/${INSTALL_DIR}" | |
| cp -R "${PACKAGE_DIR}/." "${PKG_ROOT}/${INSTALL_DIR}/" | |
| mkdir -p "${PKG_ROOT}/etc/paths.d" | |
| echo "${INSTALL_DIR}" > "${PKG_ROOT}/etc/paths.d/codenet" | |
| pkgbuild \ | |
| --root "${PKG_ROOT}" \ | |
| --identifier "${PKG_ID}" \ | |
| --version "${PKG_VERSION}" \ | |
| --install-location "/" \ | |
| "${PKG_DIR}/dotnet-runtime-osx-${{ matrix.arch }}.pkg" | |
| ls -lh "${PKG_DIR}/dotnet-runtime-osx-${{ matrix.arch }}.pkg" | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: dotnet-runtime-osx-${{ matrix.arch }} | |
| path: artifacts/package/dotnet-runtime-osx-${{ matrix.arch }}.tar.gz | |
| - uses: actions/upload-artifact@v7 | |
| if: runner.os == 'macOS' | |
| with: | |
| name: dotnet-runtime-osx-${{ matrix.arch }}-installer | |
| path: artifacts/package/dotnet-runtime-osx-${{ matrix.arch }}.pkg | |
| - name: Publish to Release | |
| if: github.ref == 'refs/heads/main' | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| TAG=runtime-v10.0.400 | |
| # 新仓库或首次运行时 Release 可能尚不存在,必须先确保它存在: | |
| # 否则 gh release upload 会以 "release not found" 失败,让构建成功却整个 job 判红。 | |
| # 多个 job 会并发执行这一步,因此创建失败(例如已被其它 job 抢先创建)时忽略错误。 | |
| if ! gh release view "$TAG" >/dev/null 2>&1; then | |
| gh release create "$TAG" \ | |
| --title "CodeNet Runtime v10.0.400" \ | |
| --notes "CodeNet 运行时构建产物(CoreCLR + 共享框架 + 宿主),平铺布局,需并入既有 SDK 使用。可用的完整 SDK 见 Release sdk-v10.0.400。" \ | |
| >/dev/null 2>&1 || true | |
| fi | |
| cd artifacts/package | |
| shopt -s nullglob | |
| for f in dotnet-runtime-*; do | |
| new="dotnet-codenet-${f#dotnet-runtime-}" | |
| cp -f "$f" "$new" | |
| echo "uploading $new" | |
| gh release upload "$TAG" "$new" --clobber | |
| done | |
| build-linux: | |
| name: Build Linux (${{ matrix.arch }}) | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.target_os == 'linux' || github.event_name != 'workflow_dispatch' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: x64 | |
| runs-on: ubuntu-latest | |
| - arch: arm64 | |
| runs-on: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runs-on }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake ninja-build clang liblttng-ust-dev libkrb5-dev libssl-dev libicu-dev libcurl4-openssl-dev zlib1g-dev libnuma-dev | |
| - name: Build .NET Runtime for Linux ${{ matrix.arch }} | |
| run: | | |
| ./build.sh -arch ${{ matrix.arch }} -os linux -c Release \ | |
| --subset clr+libs \ | |
| --ninja \ | |
| /p:TargetOS=linux \ | |
| /p:TargetArchitecture=${{ matrix.arch }} \ | |
| /p:Configuration=Release | |
| - name: Verify build output | |
| run: | | |
| set -uo pipefail | |
| OS_ID=linux | |
| ARCH="${{ matrix.arch }}" | |
| CORECLR_LIB="libcoreclr.so" | |
| HOST_BIN="corerun" | |
| CORECLR_DIR="artifacts/bin/coreclr/${OS_ID}.${ARCH}.Release" | |
| LIBS_DIR="$(ls -d artifacts/bin/runtime/*-${OS_ID}-Release-${ARCH} 2>/dev/null | head -n 1)" | |
| # 宿主 muxer 的安装目录,按 TargetRid 命名(linux-x64.Release/corehost)。 | |
| HOST_DIR="artifacts/bin/${OS_ID}-${ARCH}.Release/corehost" | |
| if [ ! -f "${CORECLR_DIR}/${CORECLR_LIB}" ] || [ ! -f "${CORECLR_DIR}/${HOST_BIN}" ]; then | |
| echo "::error::CoreCLR output is incomplete: expected ${CORECLR_DIR}/{${CORECLR_LIB},${HOST_BIN}}" | |
| echo "--- artifacts/bin/coreclr ---" | |
| ls -la artifacts/bin/coreclr 2>/dev/null || echo " (missing)" | |
| echo "--- ${CORECLR_DIR} ---" | |
| ls -la "${CORECLR_DIR}" 2>/dev/null || echo " (missing)" | |
| exit 1 | |
| fi | |
| # 运行时包必须自带宿主入口:muxer(codenet/dotnet)+ hostfxr/hostpolicy。 | |
| # 这些由 install_with_stripped_symbols 装进 corehost 目录,缺任一项包内就没有 | |
| # 任何可启动的宿主(此前正是如此,包只有 CoreCLR 与托管库)。 | |
| for host_file in codenet dotnet libhostfxr.so libhostpolicy.so; do | |
| if [ ! -f "${HOST_DIR}/${host_file}" ]; then | |
| echo "::error::Host file is missing: expected ${HOST_DIR}/${host_file}" | |
| ls -la "${HOST_DIR}" 2>/dev/null || echo " (missing)" | |
| exit 1 | |
| fi | |
| done | |
| echo "CoreCLR output : ${CORECLR_DIR}" | |
| echo "Managed libraries : ${LIBS_DIR:-<not found>}" | |
| echo "Host files : ${HOST_DIR}/{codenet,dotnet,libhostfxr.so,libhostpolicy.so}" | |
| if [ -n "${LIBS_DIR}" ]; then | |
| DLL_COUNT="$(find "${LIBS_DIR}" -maxdepth 1 -name '*.dll' | wc -l | tr -d ' ')" | |
| echo "Managed assemblies: ${DLL_COUNT}" | |
| if [ "${DLL_COUNT}" -lt 50 ]; then | |
| echo "::warning::Only ${DLL_COUNT} assemblies in ${LIBS_DIR}; expected the full shared framework." | |
| fi | |
| else | |
| echo "::warning::Managed libraries directory not found; artifact will contain CoreCLR only." | |
| fi | |
| { | |
| echo "CORECLR_DIR=${CORECLR_DIR}" | |
| echo "LIBS_DIR=${LIBS_DIR}" | |
| echo "HOST_DIR=${HOST_DIR}" | |
| echo "PACKAGE_DIR=artifacts/package/runtime" | |
| } >> "$GITHUB_ENV" | |
| - name: Package Runtime | |
| run: | | |
| set -euo pipefail | |
| rm -rf "${PACKAGE_DIR}" | |
| mkdir -p "${PACKAGE_DIR}" | |
| cp -R "${CORECLR_DIR}/." "${PACKAGE_DIR}/" | |
| if [ -n "${LIBS_DIR}" ] && [ -d "${LIBS_DIR}" ]; then | |
| cp -R "${LIBS_DIR}/." "${PACKAGE_DIR}/" | |
| fi | |
| # 宿主 muxer 与 hostfxr/hostpolicy 不在 CORECLR_DIR/LIBS_DIR 内,必须单独收集, | |
| # 否则包里有运行时却没有任何可启动宿主。 | |
| # 逐个点名复制(而非整目录):同目录还有 install_with_stripped_symbols 产出的 | |
| # .dbg 调试符号、.a 静态库和头文件,都不该进运行时包。cp -fp 保留可执行权限。 | |
| for host_file in codenet dotnet libhostfxr.so libhostpolicy.so; do | |
| if [ -f "${HOST_DIR}/${host_file}" ]; then | |
| cp -fp "${HOST_DIR}/${host_file}" "${PACKAGE_DIR}/" | |
| else | |
| echo "::warning::${host_file} not found in ${HOST_DIR}" | |
| fi | |
| done | |
| echo "Packaged $(find "${PACKAGE_DIR}" -type f | wc -l | tr -d ' ') files" | |
| tar czf "artifacts/package/dotnet-runtime-linux-${{ matrix.arch }}.tar.gz" -C "${PACKAGE_DIR}" . | |
| ls -lh artifacts/package/ | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: dotnet-runtime-linux-${{ matrix.arch }} | |
| path: artifacts/package/dotnet-runtime-linux-${{ matrix.arch }}.tar.gz | |
| - name: Publish to Release | |
| if: github.ref == 'refs/heads/main' | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| TAG=runtime-v10.0.400 | |
| # 新仓库或首次运行时 Release 可能尚不存在,必须先确保它存在: | |
| # 否则 gh release upload 会以 "release not found" 失败,让构建成功却整个 job 判红。 | |
| # 多个 job 会并发执行这一步,因此创建失败(例如已被其它 job 抢先创建)时忽略错误。 | |
| if ! gh release view "$TAG" >/dev/null 2>&1; then | |
| gh release create "$TAG" \ | |
| --title "CodeNet Runtime v10.0.400" \ | |
| --notes "CodeNet 运行时构建产物(CoreCLR + 共享框架 + 宿主),平铺布局,需并入既有 SDK 使用。可用的完整 SDK 见 Release sdk-v10.0.400。" \ | |
| >/dev/null 2>&1 || true | |
| fi | |
| cd artifacts/package | |
| shopt -s nullglob | |
| for f in dotnet-runtime-*; do | |
| new="dotnet-codenet-${f#dotnet-runtime-}" | |
| cp -f "$f" "$new" | |
| echo "uploading $new" | |
| gh release upload "$TAG" "$new" --clobber | |
| done | |
| build-windows: | |
| name: Build Windows (${{ matrix.arch }}) | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.target_os == 'win' || github.event_name != 'workflow_dispatch' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: x64 | |
| runs-on: windows-latest | |
| - arch: arm64 | |
| runs-on: windows-11-arm | |
| runs-on: ${{ matrix.runs-on }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 1 | |
| - name: Build .NET Runtime for Windows ${{ matrix.arch }} | |
| run: | | |
| .\build.cmd -arch ${{ matrix.arch }} -os windows -c Release -subset clr+libs /p:TargetOS=windows /p:TargetArchitecture=${{ matrix.arch }} /p:Configuration=Release | |
| - name: Verify build output | |
| shell: pwsh | |
| run: | | |
| # 目录名取自 TargetOS(windows/osx/linux),Windows 上是 `windows.<arch>.Release`, | |
| # 不是 `win.`;libraries 目录同理为 `<tfm>-windows-Release-<arch>`。 | |
| $coreclrDir = "artifacts\bin\coreclr\windows.${{ matrix.arch }}.Release" | |
| $libsDir = Get-ChildItem -Path "artifacts\bin\runtime" -Directory ` | |
| -Filter "*-windows-Release-${{ matrix.arch }}" -ErrorAction SilentlyContinue | | |
| Select-Object -First 1 | |
| # 宿主 muxer 的安装目录,按 TargetRid 命名(win-x64.Release\corehost); | |
| # 注意不是上面的 `windows.` 前缀。 | |
| $hostDir = "artifacts\bin\win-${{ matrix.arch }}.Release\corehost" | |
| if (-not (Test-Path (Join-Path $coreclrDir "coreclr.dll")) -or | |
| -not (Test-Path (Join-Path $coreclrDir "corerun.exe"))) { | |
| Write-Host "::error::CoreCLR output is incomplete: expected $coreclrDir\{coreclr.dll,corerun.exe}" | |
| if (Test-Path "artifacts\bin\coreclr") { Get-ChildItem "artifacts\bin\coreclr" } | |
| if (Test-Path $coreclrDir) { Get-ChildItem $coreclrDir } | |
| exit 1 | |
| } | |
| Write-Host "CoreCLR output : $coreclrDir" | |
| if ($libsDir) { | |
| $dllCount = (Get-ChildItem -Path $libsDir.FullName -Filter "*.dll").Count | |
| Write-Host "Managed libraries : $($libsDir.FullName)" | |
| Write-Host "Managed assemblies: $dllCount" | |
| if ($dllCount -lt 50) { | |
| Write-Host "::warning::Only $dllCount assemblies in $($libsDir.FullName); expected the full shared framework." | |
| } | |
| } else { | |
| Write-Host "::warning::Managed libraries directory not found; artifact will contain CoreCLR only." | |
| } | |
| # 运行时包必须自带宿主入口:muxer(codenet/dotnet)+ hostfxr/hostpolicy。 | |
| # 这些由 install_with_stripped_symbols 装进 corehost 目录,缺任一项包内就没有 | |
| # 任何可启动的宿主(此前正是如此,包只有 CoreCLR 与托管库)。 | |
| foreach ($hostFile in @("codenet.exe", "dotnet.exe", "hostfxr.dll", "hostpolicy.dll")) { | |
| if (-not (Test-Path (Join-Path $hostDir $hostFile))) { | |
| Write-Host "::error::Host file is missing: expected $hostDir\$hostFile" | |
| if (Test-Path $hostDir) { Get-ChildItem $hostDir } | |
| exit 1 | |
| } | |
| } | |
| Write-Host "Host files : $hostDir\{codenet.exe,dotnet.exe,hostfxr.dll,hostpolicy.dll}" | |
| @( | |
| "CORECLR_DIR=$coreclrDir" | |
| "LIBS_DIR=$($libsDir.FullName)" | |
| "HOST_DIR=$hostDir" | |
| "PACKAGE_DIR=artifacts\package\runtime" | |
| ) | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | |
| - name: Package Runtime | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force -Path $env:PACKAGE_DIR | Out-Null | |
| Copy-Item -Path (Join-Path $env:CORECLR_DIR "*") -Destination $env:PACKAGE_DIR -Recurse -Force | |
| if ($env:LIBS_DIR -and (Test-Path $env:LIBS_DIR)) { | |
| Copy-Item -Path (Join-Path $env:LIBS_DIR "*") -Destination $env:PACKAGE_DIR -Recurse -Force | |
| } | |
| # 宿主 muxer 与 hostfxr/hostpolicy 不在 CORECLR_DIR/LIBS_DIR 内,必须单独收集, | |
| # 否则包里有运行时却没有任何可启动宿主。 | |
| # 逐个点名复制(而非整目录):同目录还有 hostfxr.lib/hostpolicy.lib 等导入库 | |
| # 和头文件,都不该进运行时包。 | |
| foreach ($hostFile in @("codenet.exe", "dotnet.exe", "hostfxr.dll", "hostpolicy.dll")) { | |
| $hostSrc = Join-Path $env:HOST_DIR $hostFile | |
| if (Test-Path $hostSrc) { | |
| Copy-Item -Path $hostSrc -Destination $env:PACKAGE_DIR -Force | |
| } else { | |
| Write-Host "::warning::$hostFile not found in $env:HOST_DIR" | |
| } | |
| } | |
| $count = (Get-ChildItem -Path $env:PACKAGE_DIR -Recurse -File).Count | |
| Write-Host "Packaged $count files" | |
| New-Item -ItemType Directory -Force -Path "artifacts\package" | Out-Null | |
| Compress-Archive -Path (Join-Path $env:PACKAGE_DIR "*") ` | |
| -DestinationPath "artifacts\package\dotnet-runtime-win-${{ matrix.arch }}.zip" | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: dotnet-runtime-win-${{ matrix.arch }} | |
| path: artifacts\package\dotnet-runtime-win-${{ matrix.arch }}.zip | |
| - name: Publish to Release | |
| if: github.ref == 'refs/heads/main' | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| TAG=runtime-v10.0.400 | |
| # 新仓库或首次运行时 Release 可能尚不存在,必须先确保它存在: | |
| # 否则 gh release upload 会以 "release not found" 失败,让构建成功却整个 job 判红。 | |
| # 多个 job 会并发执行这一步,因此创建失败(例如已被其它 job 抢先创建)时忽略错误。 | |
| if ! gh release view "$TAG" >/dev/null 2>&1; then | |
| gh release create "$TAG" \ | |
| --title "CodeNet Runtime v10.0.400" \ | |
| --notes "CodeNet 运行时构建产物(CoreCLR + 共享框架 + 宿主),平铺布局,需并入既有 SDK 使用。可用的完整 SDK 见 Release sdk-v10.0.400。" \ | |
| >/dev/null 2>&1 || true | |
| fi | |
| cd artifacts/package | |
| shopt -s nullglob | |
| for f in dotnet-runtime-*; do | |
| new="dotnet-codenet-${f#dotnet-runtime-}" | |
| cp -f "$f" "$new" | |
| echo "uploading $new" | |
| gh release upload "$TAG" "$new" --clobber | |
| done | |
| # 运行时包发布完毕后再组装 CodeNetSDK(官方 SDK 骨架 + 刚发出去的运行时)。 | |
| # 组装逻辑与产物校验都在 build-codenet-sdk.yml + scripts/codenet-sdk/assemble-codenet-sdk.sh。 | |
| # 只在 main 上跑:SDK 工作流是从 Release 取运行时包的,PR 上没有资产可取。 | |
| # 需显式判 build-macos 的结果:workflow_dispatch 指定 linux/win 时该 job 会被 skip, | |
| # 而 needs 里有 skipped 的 job 时默认会把本 job 也 skip 掉。 | |
| build-sdk: | |
| needs: [build-macos, build-linux, build-windows] | |
| if: ${{ always() && github.ref == 'refs/heads/main' && needs.build-macos.result == 'success' }} | |
| uses: ./.github/workflows/build-codenet-sdk.yml | |
| # 被调工作流要用 GITHUB_TOKEN 下载运行时包、上传 SDK 资产。 | |
| secrets: inherit |