#!/usr/bin/env bash # push.sh — pack and push the ZB.MOM.WW.LocalDb NuGet packages (core, Contracts, Replication) to the Gitea feed. # # Required environment variables: # GITEA_NUGET_SOURCE — full URL of the Gitea NuGet feed # e.g. https://gitea.dohertylan.com/api/packages/dohertj2/nuget/index.json # GITEA_NUGET_KEY — Gitea access token with package:write permission # # Usage: # export GITEA_NUGET_SOURCE="https://gitea.dohertylan.com/api/packages/dohertj2/nuget/index.json" # export GITEA_NUGET_KEY="your-gitea-token" # ./build/push.sh set -euo pipefail : "${GITEA_NUGET_SOURCE:?set GITEA_NUGET_SOURCE to your Gitea NuGet feed URL}" : "${GITEA_NUGET_KEY:?set GITEA_NUGET_KEY to your Gitea access token}" # Named solution, named output, and a cd to the repo root, all for one reason: `dotnet pack` # with neither a project argument nor a fixed working directory packs whatever solution # happens to sit in the CALLER's directory — and then pushes it to a live feed under this # script's name. Invoked as `bash /path/to/ZB.MOM.WW.LocalDb/build/push.sh` from another # repo's checkout, the relative form packed and published 25 unrelated packages (recovered # with `dotnet nuget delete`, but only because the token happened to carry delete rights). # A publish script must be unambiguous about WHAT it publishes no matter where it is run. REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$REPO_ROOT" dotnet pack ZB.MOM.WW.LocalDb.slnx -c Release -o "$REPO_ROOT/artifacts" dotnet nuget push "$REPO_ROOT/artifacts/*.nupkg" \ --source "$GITEA_NUGET_SOURCE" \ --api-key "$GITEA_NUGET_KEY" \ --skip-duplicate