# Publishes a worker artifact to the canary channel on every push to main. # Its version is the released one plus `-canary.`. The publish # refuses to move the channel to a commit behind the one it has, so a # revert needs a publish by hand from a machine with the credentials. on: push: {refs: [refs/heads/main]} image: node:22-trixie cache: [/root/.local/share/pnpm/store, /root/.cache/node/corepack] runners: [ci.knotless.dev] secrets: [PDSJS_SITE_TOKEN] env: COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" PDS_URL: https://pds.pdsjs.dev PDS_IDENTIFIER: pdsjs.dev steps: - name: check credentials run: | if [ -z "${PDSJS_SITE_TOKEN:-}" ]; then echo "PDSJS_SITE_TOKEN is not granted, so this push would publish nothing." echo "Seal it to ci.knotless.dev with knotless secret. It is an app password for $PDS_IDENTIFIER." exit 1 fi echo "publishing to $PDS_URL as $PDS_IDENTIFIER" - name: build run: | corepack enable pnpm install --frozen-lockfile npm run build:ui VERSION_SUFFIX="-canary.$(echo "$KNOTLESS_RUN_SHA" | cut -c1-7)" npm run build:worker test -s dist/worker/index.js test -s dist/worker/manifest.json - name: publish run: PDS_PASSWORD="$PDSJS_SITE_TOKEN" CHANNEL=canary node scripts/publish-worker-artifact.mjs