diff --git a/.gitea/workflows/nuget.yml b/.gitea/workflows/nuget.yml index 73ef44c..4ef3431 100644 --- a/.gitea/workflows/nuget.yml +++ b/.gitea/workflows/nuget.yml @@ -22,12 +22,33 @@ jobs: - name: Pack run: dotnet pack CBDDC.Libs.slnx --configuration Release --no-restore --output artifacts/nuget + - name: Verify expected packages + shell: bash + run: | + set -euo pipefail + + expected=( + "ZB.MOM.WW.CBDDC.Core" + "ZB.MOM.WW.CBDDC.Hosting" + "ZB.MOM.WW.CBDDC.Network" + "ZB.MOM.WW.CBDDC.Persistence" + ) + + for id in "${expected[@]}"; do + if ! compgen -G "artifacts/nuget/${id}.*.nupkg" > /dev/null; then + echo "Missing package for ${id}" + exit 1 + fi + done + + find artifacts/nuget -name '*.nupkg' ! -name '*.symbols.nupkg' -print + - name: Publish to Gitea NuGet shell: bash env: NUGET_SOURCE_URL: ${{ github.server_url }}/api/packages/${{ github.repository_owner }}/nuget/index.json NUGET_USERNAME: ${{ secrets.NUGET_USERNAME || github.actor }} - NUGET_TOKEN: ${{ secrets.NUGET_TOKEN || secrets.GITHUB_TOKEN }} + NUGET_TOKEN: ${{ secrets.NUGET_TOKEN || secrets.PACKAGE_TOKEN || secrets.GITHUB_TOKEN }} run: | set -euo pipefail @@ -43,8 +64,20 @@ jobs: --password "$NUGET_TOKEN" \ --store-password-in-clear-text - find artifacts/nuget -name '*.nupkg' ! -name '*.symbols.nupkg' -print0 | \ - xargs -0 -I{} dotnet nuget push "{}" \ + shopt -s nullglob + packages=(artifacts/nuget/*.nupkg) + if [ ${#packages[@]} -eq 0 ]; then + echo "No NuGet packages found to publish." + exit 1 + fi + + for pkg in "${packages[@]}"; do + if [[ "$pkg" == *.symbols.nupkg ]]; then + continue + fi + + dotnet nuget push "$pkg" \ --source gitea \ --api-key "$NUGET_TOKEN" \ --skip-duplicate + done