Something went wrong. Try again.
React blog kit backed by AT Protocol. Provides filtering UI, pagination, Bluesky comments/embeds, subscribe widget, and markdown rendering.
Something went wrong. Try again.
2.5 kB · 79 lines
Shell
at main
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980#!/usr/bin/env bash## bun run publish [--deploy] "commit message"## Submodule-aware publish workflow:# 1. sequoia publish → mints AT URI, cross-posts to Bluesky, mutates frontmatter# 2. git stage + commit (scoped to publish artifacts)# 3. (--deploy only) vercel build --prod → produces .vercel/output# 4. (--deploy only) vercel deploy --prebuilt --prod → uploads prebuilt artifacts# 5. revalidate via BLOG_REVALIDATE_URL so the new post is live# 6. git push → keeps git in sync with deployed state## Environment variables:# BLOG_REVALIDATE_URL → endpoint to call on revalidation (default: none)# REVALIDATE_SECRET → secret header value (from consumer's .env)set -euo pipefail
DEPLOY=falseARGS=()for arg in "$@"; do case "$arg" in --deploy) DEPLOY=true ;; *) ARGS+=("$arg") ;; esacdone
if [ "${#ARGS[@]}" -lt 1 ] || [ -z "${ARGS[0]}" ]; then echo "Usage: bun run publish [--deploy] \"commit message\"" >&2 exit 1fi
COMMIT_MSG="${ARGS[0]}"
# Pre-flight: nothing already staged (we manage staging ourselves)if ! git diff --staged --quiet; then echo "Error: you have staged changes. Unstage or commit them separately first." >&2 git diff --staged --name-only >&2 exit 1fi
# 1. Publish to PDS + Blueskyecho "Publishing to sequoia..."sequoia publish
# 2. Stage only the artifacts sequoia producesgit add src/content/blog/ .sequoia-state.json
# 3. Commit (skip if sequoia made no changes — e.g., re-run on unchanged content)if git diff --staged --quiet; then echo "No publish changes to commit. Continuing."else git commit -m "$COMMIT_MSG"fi
# 4. (--deploy only) Build with Vercel's toolchain → .vercel/output# 5. (--deploy only) Upload prebuilt artifactsif $DEPLOY; then echo "Deploying to Vercel..." bunx vercel build --prod bunx vercel deploy --prebuilt --prodfi
# 6. Revalidate via BLOG_REVALIDATE_URL (consumer-specific)if [ -n "${BLOG_REVALIDATE_URL:-}" ]; then echo "Revalidating: ${BLOG_REVALIDATE_URL}" if [ -n "${REVALIDATE_SECRET:-}" ]; then curl -sf -X POST "$BLOG_REVALIDATE_URL" \ -H "x-revalidate-secret: $REVALIDATE_SECRET" || \ echo "Warning: revalidation request failed (continuing)" else echo "Warning: BLOG_REVALIDATE_URL set but REVALIDATE_SECRET not set; skipping revalidation" fielse echo "No BLOG_REVALIDATE_URL configured; skipping revalidation"fi
# 7. Push so origin/main matches deployed stateecho "Pushing to remote..."git push