b62981ff80
Secrets/push.sh, Theme/pack.sh+push.sh, Audit/pack.sh+push.sh and Auth/pack.sh+push.sh
all carried the CWD-pack bug LocalDb's push.sh was cured of in 0038d46: a bare
'dotnet pack -c Release -o ./artifacts' packs whatever solution sits in the CALLER's
working directory, and the push scripts then shove the caller's ./artifacts/*.nupkg
onto the live Gitea feed (the incident that briefly published 25 unrelated packages).
Each script now cds to its own repo root, names its .slnx explicitly, writes to an
absolute artifacts path, and (push.sh) pushes an anchored glob. Verified by bash -n on
all seven plus a positive control: Audit's pack.sh run from a foreign CWD packed only
ZB.MOM.WW.Audit into its own artifacts dir and left the caller's directory untouched.
Push scripts deliberately NOT executed (they publish); pack half verified only.
Closes ScadaBridge deferred-work register row 42 (cross-repo).
36 lines
1.6 KiB
Bash
Executable File
36 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# push.sh — pack and push all ZB.MOM.WW.Theme NuGet packages 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 by absolute path from another repo's checkout, the relative form
|
|
# packed and published 25 unrelated packages (LocalDb's copy of this script, fixed in
|
|
# 0038d46; 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.Theme.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
|