mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
From this coordinator the 115 MB release download fails about half the time, mid-transfer, with an SSL record-mac error; curl's own --retry does not help because each attempt breaks identically. Loop the fetch, force HTTP/1.1, and run the binary before accepting it. The durable fix is baking nsyte into the CI image.
119 lines
5.0 KiB
YAML
119 lines
5.0 KiB
YAML
name: Deploy nsite
|
|
|
|
# Builds dist/ and publishes it as the named nsite "shakespeare" (NIP-5A kind
|
|
# 35128) described by .nsite/config.json: the files become Blossom blobs, the
|
|
# manifest mapping path -> sha256 goes to relays, and npanel on venus serves
|
|
# shakespeare.diy from it. Runs on pushes to the default branch, alongside
|
|
# Test.
|
|
#
|
|
# Replaces the GitLab `deploy-nsite` job, which published the same site under a
|
|
# PERSONAL npub with nsyte 0.24.1. The signing pubkey IS the site address, so
|
|
# this one lives in the Team Soapbox namespace instead.
|
|
#
|
|
# Secrets are provisioned by the ngit-ci operator as
|
|
# NGIT_CI_SECRET_<ALIAS>__<NAME> (note the double underscore) and injected ONLY
|
|
# on maintainer-authored triggers, which a push to a watched repo always is.
|
|
# This job needs one:
|
|
# NSYTE_BUNKER nbunksec1... -- a pre-established NIP-46 session, the form
|
|
# nsyte documents for CI.
|
|
# An empty NSYTE_BUNKER fails the job rather than skipping quietly: this is the
|
|
# only workflow that publishes the client anywhere, so a skipped run would
|
|
# leave the nsite silently pinned to an older build.
|
|
#
|
|
# NOTE: *.shakespeare.diy is NOT served from here. The wildcard keeps its own
|
|
# Caddy vhost and /var/www tree on venus, because the nsite catch-all issues
|
|
# certificates on demand over HTTP-01 and cannot get a wildcard.
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
|
|
# Ahead of the build, so a config nsyte will not accept costs seconds
|
|
# rather than failing at the end of a green-looking run.
|
|
- name: Install nsyte and validate the config
|
|
env:
|
|
NSYTE_BUNKER: ${{ secrets.NSYTE_BUNKER }}
|
|
run: |
|
|
set -eu
|
|
: "${NSYTE_BUNKER:?NSYTE_BUNKER is not set; ask the ngit-ci operator to provision it for this repo alias.}"
|
|
|
|
# Pin the binary. An unversioned install has been observed pulling
|
|
# 0.10.1, which emits legacy kind-34128 events that every current
|
|
# gateway ignores while still reporting a successful deploy.
|
|
# This 115 MB download is the single flakiest thing in the job: from
|
|
# this coordinator it fails perhaps half the time, mid-transfer, with
|
|
# "SSL_read: decryption failed or bad record mac". curl's own --retry
|
|
# is not enough because every attempt breaks the same way, so the
|
|
# whole fetch is retried in a loop, forcing HTTP/1.1 (the fault has
|
|
# the shape of an HTTP/2 framing problem) and proving the binary
|
|
# actually runs before accepting it. A truncated download otherwise
|
|
# surfaces much later as a confusing nsyte error.
|
|
#
|
|
# The durable fix is to bake nsyte into the coordinator's CI image,
|
|
# the way it already pre-bakes the other toolchains.
|
|
NSYTE_URL=https://github.com/sandwichfarm/nsyte/releases/download/v0.27.2/nsyte-linux-0.27.2
|
|
ok=""
|
|
for attempt in 1 2 3 4 5; do
|
|
if curl -fsSL --http1.1 --retry 2 --retry-delay 5 --retry-all-errors \
|
|
--connect-timeout 20 --max-time 900 -o /usr/local/bin/nsyte "$NSYTE_URL" \
|
|
&& chmod +x /usr/local/bin/nsyte \
|
|
&& nsyte --version; then
|
|
ok=yes
|
|
break
|
|
fi
|
|
echo "nsyte download attempt $attempt failed; retrying in 10s"
|
|
sleep 10
|
|
done
|
|
test -n "$ok" || { echo "could not download a working nsyte after 5 attempts"; exit 1; }
|
|
|
|
nsyte validate
|
|
|
|
- run: npm ci
|
|
|
|
# Builds dist/ and copies index.html -> 404.html, the path NIP-5A host
|
|
# servers fall back to.
|
|
- run: npm run build
|
|
|
|
# Sourcemaps are ~290 files and 30 MB of blobs nobody fetches, and they
|
|
# near-double the manifest. The GitLab job dropped them too.
|
|
- run: find dist -name '*.map' -delete
|
|
|
|
- name: Publish to Blossom + relays
|
|
env:
|
|
NSYTE_BUNKER: ${{ secrets.NSYTE_BUNKER }}
|
|
run: |
|
|
set -eu
|
|
|
|
# Relays, servers and the site id all come from .nsite/config.json,
|
|
# so they are versioned with the client rather than split across this
|
|
# file. The secrets scan is skipped because it prompts on false
|
|
# positives in our own bundle (pubkeys, bunker:// parsing code), and
|
|
# a prompt is unanswerable here -- with -i it defaults to N and
|
|
# aborts.
|
|
set +e
|
|
nsyte deploy dist \
|
|
--sec "$NSYTE_BUNKER" \
|
|
--concurrency 2 \
|
|
--non-interactive \
|
|
--skip-secrets-scan 2>&1 | tee /tmp/nsyte-deploy.log
|
|
status="${PIPESTATUS[0]}"
|
|
set -e
|
|
|
|
# A deploy that changes no file exits NON-ZERO with "No new files to
|
|
# upload". That is success: the manifest already on the relays
|
|
# describes exactly this build.
|
|
if [ "$status" -ne 0 ] && ! grep -q "No new files to upload" /tmp/nsyte-deploy.log; then
|
|
exit "$status"
|
|
fi
|