This commit is contained in:
parent
da2c4e921f
commit
2c41a374ec
1 changed files with 27 additions and 23 deletions
|
|
@ -22,28 +22,32 @@ jobs:
|
||||||
export REF_NAME="${GITHUB_REF_NAME:-main}"
|
export REF_NAME="${GITHUB_REF_NAME:-main}"
|
||||||
|
|
||||||
nix --extra-experimental-features "nix-command flakes" \
|
nix --extra-experimental-features "nix-command flakes" \
|
||||||
shell nixpkgs#git nixpkgs#nodejs_24 nixpkgs#curl nixpkgs#jq \
|
shell nixpkgs#git \
|
||||||
-c sh -lc '
|
-c git clone --depth 1 --branch "$REF_NAME" "$REPO_URL" source
|
||||||
set -eu
|
|
||||||
git clone --depth 1 --branch "$REF_NAME" "$REPO_URL" source
|
|
||||||
cd source
|
|
||||||
npm ci
|
|
||||||
rm -rf dist
|
|
||||||
npm run build
|
|
||||||
test -f dist/index.html
|
|
||||||
test -f dist/speeches/index.html
|
|
||||||
test -f dist/assets/icons/familyfed-favicon.png
|
|
||||||
|
|
||||||
ALLOC_ID=$(curl -sf \
|
cd source
|
||||||
-H "X-Nomad-Token: $NOMAD_TOKEN" \
|
nix --extra-experimental-features "nix-command flakes" \
|
||||||
"$NOMAD_ADDR/v1/job/familyfed/allocations" \
|
shell nixpkgs#nodejs_24 \
|
||||||
| jq -r "map(select(.ClientStatus == \"running\"))[0].ID")
|
-c npm ci
|
||||||
|
rm -rf dist
|
||||||
|
nix --extra-experimental-features "nix-command flakes" \
|
||||||
|
shell nixpkgs#nodejs_24 \
|
||||||
|
-c npm run build
|
||||||
|
|
||||||
test -n "$ALLOC_ID"
|
test -f dist/index.html
|
||||||
test "$ALLOC_ID" != "null"
|
test -f dist/speeches/index.html
|
||||||
echo "Stopping allocation to trigger fresh prestart: $ALLOC_ID"
|
test -f dist/assets/icons/familyfed-favicon.png
|
||||||
curl -sf -X POST \
|
|
||||||
-H "X-Nomad-Token: $NOMAD_TOKEN" \
|
ALLOC_ID=$(nix --extra-experimental-features "nix-command flakes" \
|
||||||
"$NOMAD_ADDR/v1/allocation/$ALLOC_ID/stop"
|
shell nixpkgs#curl nixpkgs#jq \
|
||||||
echo "Deploy triggered. Nomad will schedule a new alloc that re-fetches the site."
|
-c sh -c 'curl -sf -H "X-Nomad-Token: $NOMAD_TOKEN" "$NOMAD_ADDR/v1/job/familyfed/allocations" | jq -r "map(select(.ClientStatus == \"running\"))[0].ID"')
|
||||||
'
|
|
||||||
|
test -n "$ALLOC_ID"
|
||||||
|
test "$ALLOC_ID" != "null"
|
||||||
|
echo "Stopping allocation to trigger fresh prestart: $ALLOC_ID"
|
||||||
|
nix --extra-experimental-features "nix-command flakes" \
|
||||||
|
shell nixpkgs#curl \
|
||||||
|
-c curl -sf -X POST \
|
||||||
|
-H "X-Nomad-Token: $NOMAD_TOKEN" \
|
||||||
|
"$NOMAD_ADDR/v1/allocation/$ALLOC_ID/stop"
|
||||||
|
echo "Deploy triggered. Nomad will schedule a new alloc that re-fetches the site."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue