Files
bsky-social-app/scripts/denisPublish.sh
T
Claude fbcd5422ee Build PR OTA bundle in parallel with the fingerprint check
publish-pr-ota needed fingerprint-native, so the bundle build - the slow
half - did not start until the fingerprint had finished, even though the
bundle does not depend on the fingerprint verdict. Only the decision to
publish it does.

Split the job in two: build-pr-ota builds and assembles the bundle with no
dependency on the fingerprint (so it runs alongside it) and hands it over
as a short-lived artifact, and publish-pr-ota keeps the fingerprint gate
and does just the denis publish. A dirty fingerprint now discards an
already-built bundle instead of saving the build, which costs a runner but
takes the fingerprint's wall clock off the critical path of every
fingerprint-clean PR.

Since the build job already has the EAS CLI set up, it also reads the
native build numbers and exposes them (along with the release version) as
job outputs, so the publish job needs neither EXPO_TOKEN nor node_modules
and can invoke denisPublish.sh directly rather than through the
use-build-number wrapper. denisPublish.sh gains SKIP_BUNDLE_ASSEMBLY for
that case, where bundleTempDir arrives as an artifact and ./dist is not
present; without it the script assembles the directory as before, so the
main-branch deploy is unaffected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UL83tcSq9MvwBkUGJGRyWV
2026-07-30 15:55:56 +00:00

66 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
# Publishes the just-exported Expo bundle to the denis OTA service (S3) via the
# `denis publish` CLI. Mirrors bundleUpdate.sh's inputs (runtime version, bundle
# version, build numbers) but targets denis instead of the legacy ota1 upload.
# Expects: the `denis` binary on PATH (setup-denis action), ambient AWS creds
# (configure-aws-credentials OIDC), and BSKY_IOS_BUILD_NUMBER /
# BSKY_ANDROID_VERSION_CODE from the use-build-number wrapper.
# Set when bundleTempDir was assembled by a separate job and handed over as an
# artifact, as the PR OTA flow does so the bundle can be built in parallel with
# the fingerprint check. Without it, assemble the directory from ./dist here.
if [ -n "${SKIP_BUNDLE_ASSEMBLY:-}" ]; then
echo "Using pre-assembled bundle directory..."
if [ ! -f bundleTempDir/metadata.json ]; then
echo "bundleTempDir/metadata.json is missing; nothing to publish" >&2
exit 1
fi
else
rm -rf bundleTempDir
echo "Assembling bundle directory..."
node scripts/bundleUpdate.js
fi
if [ -z "$RUNTIME_VERSION" ]; then
RUNTIME_VERSION=$(cat package.json | jq '.version' -r)
fi
# Accept a caller-supplied bundle version so that a dual-write publishes the SAME
# version to every origin. When this script and bundleUpdate.sh each called
# `date +%s` independently they produced versions seconds apart for identical
# bytes -- observed 1785102575 (denis) vs 1785102614 (ota1) for one commit. Since
# the version is part of the asset URL path, the two origins then served
# manifests pointing at paths only one of them had, so the manifest and its
# assets had to come from the same origin or the fetch 404s. Falling back to
# `date +%s` keeps standalone callers (PR previews, `pnpm make-deploy-bundle`)
# working unchanged.
BUNDLE_VERSION="${BUNDLE_VERSION:-$(date +%s)}"
DENIS_CDN_DOMAIN="${DENIS_CDN_DOMAIN:-updates.bsky.app}"
DENIS_S3_BUCKET="${DENIS_S3_BUCKET:-bsky-denis-ota-prod}"
echo "Publishing to denis..."
echo " runtime-version: $RUNTIME_VERSION"
echo " bundle-version: $BUNDLE_VERSION"
echo " channel: $CHANNEL_NAME"
echo " ios-build-number: $BSKY_IOS_BUILD_NUMBER"
echo " android-build-number: $BSKY_ANDROID_VERSION_CODE"
echo " cdn-domain: $DENIS_CDN_DOMAIN"
echo " s3-bucket: $DENIS_S3_BUCKET"
denis publish \
--bundle-dir bundleTempDir \
--runtime-version "$RUNTIME_VERSION" \
--bundle-version "$BUNDLE_VERSION" \
--channel "$CHANNEL_NAME" \
--ios-build-number "$BSKY_IOS_BUILD_NUMBER" \
--android-build-number "$BSKY_ANDROID_VERSION_CODE" \
--cdn-domain "$DENIS_CDN_DOMAIN" \
--s3-bucket "$DENIS_S3_BUCKET"
rm -rf bundleTempDir