Files
integration_gotosocial/.gitea/workflows/build.yml
T
neonoverlordandClaude Fable 5 dd75ee5dfc
build / build (push) Failing after 0s
ci: back to strip-components=1 — pinnacle exports at root again
The subpath adaptation moved into pinnacle's postprocess-nc (the fork's
sapper --basepath prerenders everything as a 404); the export layout is
flat once more.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 20:08:20 -07:00

87 lines
4.4 KiB
YAML

name: build
# Builds the Nextcloud app archive on the psn runner, following the same shape
# as ops/psn-docker: run directly on the runner, clone by hand with credentials
# from /etc/psn-ci.env, and shell out to docker. No marketplace actions and no
# `container:` key -- neither is available here.
#
# The toolchain comes from psn-base + deb.bawnet.io, notably composer: upstream's
# `make composer` falls back to piping getcomposer.org/installer into php when
# composer is absent, and this node does not run pipe-to-shell installers.
#
# `npm ci` fetching from the public registry is the one non-sovereign hop.
# package-lock.json pins every dependency with an integrity hash.
on:
push:
branches: [main]
tags: ['v*']
workflow_dispatch:
jobs:
build:
runs-on: psn
steps:
- name: build app archive
run: |
set -e
. /etc/psn-ci.env
WORK=$(mktemp -d)
OUT=/var/tmp/psn-artifacts/integration_gotosocial
git clone -q "https://$CI_USER:$CI_TOKEN@code.bawnet.io/bawnet/integration_gotosocial" "$WORK"
VERSION=$(sed -n 's:.*<version>\(.*\)</version>.*:\1:p' "$WORK/appinfo/info.xml" | head -1)
echo "building integration_gotosocial $VERSION from $(cd "$WORK" && git rev-parse --short HEAD)"
mkdir -p "$OUT"
# The Pinnacle client rides inside this app's archive (ops/features#30).
# bawnet/pinnacle CI parks its sha256'd export on this same runner;
# rebuild pinnacle FIRST when the client changed — this job bundles
# whatever export is newest, verified against its checksum.
PINDIR=/var/tmp/psn-artifacts/pinnacle
PINTAR=$(ls -t "$PINDIR"/pinnacle-*-export.tar.gz | head -1)
[ -n "$PINTAR" ] || { echo "FATAL: no pinnacle export artifact parked"; exit 1; }
(cd "$PINDIR" && sha256sum -c "$(basename "$PINTAR").sha256")
mkdir -p "$WORK/client"
# root export: files sit directly under export/
tar -xzf "$PINTAR" -C "$WORK/client" --strip-components=1
[ -f "$WORK/client/index.html" ] || { echo "FATAL: export has no index.html"; exit 1; }
echo "bundled client: $(basename "$PINTAR")"
docker run --rm -v "$WORK":/src -v "$OUT":/out -w /src \
code.bawnet.io/ops/psn-base:latest \
bash -euo pipefail -c "
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get install -y -qq --no-install-recommends \
nodejs npm php-cli php-xml php-mbstring php-zip \
composer git make rsync sudo ca-certificates >/dev/null
node --version; npm --version
command -v composer >/dev/null || {
echo 'FATAL: composer absent - makefile would pipe an installer to php'; exit 1; }
composer install --prefer-dist --no-interaction --no-progress -q
npm ci --no-audit --no-fund
npm run build
# every PHP file must parse before we package it
find lib -name '*.php' -exec php -l {} \; | grep -v 'No syntax errors' && exit 1
# widget IDs are global in Nextcloud: they must not collide with
# integration_mastodon, and the JS registrations must match the PHP
php_ids=\$(grep -ho \"return 'gotosocial_[a-z_]*'\" lib/Dashboard/*.php | sed \"s/return '//;s/'//\" | sort)
js_ids=\$(grep -ho \"OCA.Dashboard.register('[^']*'\" src/dashboard.js src/dashboardHome.js | sed \"s/.*register('//;s/'//\" | sort)
[ \"\$php_ids\" = \"\$js_ids\" ] || { echo \"FATAL: widget ID mismatch\"; echo \"php: \$php_ids\"; echo \"js: \$js_ids\"; exit 1; }
grep -rq \"return 'mastodon_\" lib/Dashboard/ && { echo 'FATAL: upstream widget ID would collide'; exit 1; }
make appstore version=$VERSION
cp /tmp/build/integration_gotosocial-$VERSION.tar.gz /out/
cd /out && sha256sum integration_gotosocial-$VERSION.tar.gz \
| tee integration_gotosocial-$VERSION.tar.gz.sha256
"
# the container wrote node_modules/vendor as root; hand the tree back
# to the runner's uid or rm -rf fails and sinks an otherwise green run
docker run --rm -v "$WORK":/w code.bawnet.io/ops/psn-base:latest chown -R "$(id -u):$(id -g)" /w
rm -rf "$WORK"
echo "artifact:"; ls -lh "$OUT"