From 5eb1143ef3a60a91ede2cc5e4d49ad529e0346a9 Mon Sep 17 00:00:00 2001 From: Lilith River Date: Tue, 21 Jan 2025 14:42:20 -0700 Subject: [PATCH] Update CI workflow and packaging script to handle empty NuGet output files and adjust CI_TAG assignment - Modify CI workflow to set CI_TAG to "vTEST" if github.ref_name is not defined. - Change condition for creating NuGet package to check for 'musl' in matrix.target. - Enhance pack.sh script to verify that the NuGet output file is not empty, exiting with an error if it is. --- .github/workflows/ci.yml | 6 +++--- ci/pack_nuget/pack.sh | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a903f8bf0..d15f494e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -375,18 +375,18 @@ jobs: shell: bash run: ./ci/pack_nuget/pack.sh tool env: - CI_TAG: ${{ github.ref_name }} + CI_TAG: ${{ github.ref_name || "vTEST" }} PACKAGE_SUFFIX: ${{ matrix.suffix }} NUGET_RUNTIME: ${{ matrix.nuget-rid }} REPO_NAME: ${{ env.GITHUB_REPOSITORY_OWNER }}\/${{ env.GITHUB_REPOSITORY_NAME }} BINARIES_DIR: "${{ env.REL_BINARIES_DIR }}" - name: "Create NuGet Package Imageflow.NativeRuntime.${{ matrix.nuget-rid }}" - if: ${{ matrix.build-exclude != 'imageflow_abi' }} + if: ${{ contains(matrix.target, 'musl') }} shell: bash run: ./ci/pack_nuget/pack.sh env: - CI_TAG: ${{ github.ref_name }} + CI_TAG: ${{ github.ref_name || "vTEST" }} PACKAGE_SUFFIX: ${{ matrix.suffix }} NUGET_RUNTIME: ${{ matrix.nuget-rid }} REPO_NAME: ${{ env.GITHUB_REPOSITORY_OWNER }}\/${{ env.GITHUB_REPOSITORY_NAME }} diff --git a/ci/pack_nuget/pack.sh b/ci/pack_nuget/pack.sh index 1b9df8ebc..977ca1756 100755 --- a/ci/pack_nuget/pack.sh +++ b/ci/pack_nuget/pack.sh @@ -155,6 +155,13 @@ mkdir -p "$STAGING_DIR" || true rm "${NUGET_OUTPUT_FILE}" || true zip -r "${NUGET_OUTPUT_FILE}" . || 7z a -tzip "${NUGET_OUTPUT_FILE}" "*" || powershell.exe -ExecutionPolicy Bypass -File "${SCRIPT_DIR}/zip.ps1" "${NUGET_OUTPUT_FILE}" "*" + + # verify file is not empty + if [[ ! -s "${NUGET_OUTPUT_FILE}" ]]; then + echo "Error: ${NUGET_OUTPUT_FILE} is empty" + exit 1 + fi + echo "${NUGET_OUTPUT_FILE} packed" )