Skip to content

Commit f298c34

Browse files
committed
Remove the recipe gallery and its publishing
Recipes now live and publish from their own repository. This repository keeps only framework and migration examples. Deleted the remaining recipes/ folders, the manifest builder, the catalog test, the publish-directory validator, and the manifest, deploy-manifest, discover-recipes, and publish-recipes workflow jobs together with the Pages and id-token permissions they needed. The workflow is now "Validate examples" and only runs the examples build matrix.
1 parent fd8f789 commit f298c34

508 files changed

Lines changed: 7 additions & 74059 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/publish.yml‎

Lines changed: 1 addition & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
name: Validate examples and publish recipes
1+
name: Validate examples
22

33
on:
44
pull_request:
55
branches: [master]
66
push:
77
branches: [master]
88
workflow_dispatch:
9-
inputs:
10-
only:
11-
description: "Publish only this recipe slug (optional)"
12-
required: false
139

1410
permissions:
1511
contents: read
16-
pages: write
17-
id-token: write
1812

1913
concurrency:
2014
group: examples-${{ github.ref }}
@@ -95,171 +89,3 @@ jobs:
9589
;;
9690
esac
9791
test -s "$artifact"
98-
99-
manifest:
100-
runs-on: ubuntu-latest
101-
steps:
102-
- uses: actions/checkout@v4
103-
- uses: oven-sh/setup-bun@v2
104-
- run: bun test scripts/catalog.test.mjs
105-
- uses: actions/configure-pages@v5
106-
if: github.event_name != 'pull_request'
107-
- uses: actions/upload-pages-artifact@v3
108-
if: github.event_name != 'pull_request'
109-
with:
110-
path: dist
111-
112-
deploy-manifest:
113-
needs: manifest
114-
if: github.event_name != 'pull_request'
115-
runs-on: ubuntu-latest
116-
environment:
117-
name: github-pages
118-
url: ${{ steps.deployment.outputs.page_url }}
119-
steps:
120-
- name: Deploy canonical JSON feed
121-
id: deployment
122-
uses: actions/deploy-pages@v4
123-
124-
discover-recipes:
125-
runs-on: ubuntu-latest
126-
outputs:
127-
slugs: ${{ steps.list.outputs.slugs }}
128-
steps:
129-
- uses: actions/checkout@v4
130-
with:
131-
fetch-depth: 0
132-
- id: list
133-
env:
134-
ONLY: ${{ inputs.only }}
135-
BEFORE: ${{ github.event.before }}
136-
run: |
137-
if [ -n "$ONLY" ]; then
138-
test -d "recipes/$ONLY"
139-
jq -cn --arg slug "$ONLY" '[ $slug ]' | sed 's/^/slugs=/' >> "$GITHUB_OUTPUT"
140-
exit 0
141-
fi
142-
143-
all_slugs() {
144-
find recipes -mindepth 1 -maxdepth 1 -type d -print \
145-
| sed 's#^recipes/##' | sort | jq -R -s -c 'split("\n") | map(select(length > 0))'
146-
}
147-
148-
if [ "${{ github.event_name }}" = "pull_request" ] \
149-
|| [ "${{ github.event_name }}" = "workflow_dispatch" ] \
150-
|| [ -z "$BEFORE" ] \
151-
|| [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then
152-
echo "slugs=$(all_slugs)" >> "$GITHUB_OUTPUT"
153-
exit 0
154-
fi
155-
156-
# A pure rename (R100) moves a file without changing what it serves.
157-
changed=$(git diff --name-status -M "$BEFORE" "${{ github.sha }}" \
158-
| awk -F'\t' '$1 != "R100" {print $NF}')
159-
# A recipe directory that no longer exists has nothing to publish.
160-
slugs=$(printf '%s\n' "$changed" | sed -n 's#^recipes/\([^/]*\)/site/.*#\1#p' \
161-
| sort -u | while read -r slug; do if [ -d "recipes/$slug" ]; then echo "$slug"; fi; done \
162-
| jq -R -s -c 'split("\n") | map(select(length > 0))')
163-
echo "slugs=$slugs" >> "$GITHUB_OUTPUT"
164-
165-
publish-recipes:
166-
needs: discover-recipes
167-
if: needs.discover-recipes.outputs.slugs != '[]'
168-
runs-on: ubuntu-latest
169-
strategy:
170-
fail-fast: false
171-
max-parallel: 4
172-
matrix:
173-
slug: ${{ fromJson(needs.discover-recipes.outputs.slugs) }}
174-
steps:
175-
- uses: actions/checkout@v4
176-
- uses: oven-sh/setup-bun@v2
177-
- name: Install Spacefast CLI
178-
run: bun add -g spacefast@0.8.0
179-
- name: Build
180-
working-directory: recipes/${{ matrix.slug }}
181-
run: |
182-
runtime=$(jq -r '.runtime // "static"' meta.json)
183-
if [ "$runtime" = "zero" ]; then
184-
cd site
185-
bun install --frozen-lockfile
186-
if jq -e '.scripts.build' package.json >/dev/null; then
187-
bun run build
188-
fi
189-
if [ -f dist/sf.jsonc ]; then
190-
# Framework layout: the build script staged the capsule into
191-
# dist/ and already ran `sf build dist` (e.g. astro-zero).
192-
test -f dist/.spacefast/zero/public/index.html
193-
else
194-
sf build
195-
test -f .spacefast/zero/public/index.html
196-
fi
197-
if jq -e '.scripts.test' package.json >/dev/null; then
198-
bun run test
199-
fi
200-
elif [ "$runtime" = "functions" ]; then
201-
cd site
202-
bun install --frozen-lockfile
203-
# Sanity build only: `sf publish` runs its own OpenNext build.
204-
bun run build
205-
elif [ -f site/package.json ]; then
206-
cd site
207-
bun install --frozen-lockfile || bun install
208-
bun run build
209-
fi
210-
- name: Resolve and validate publish directory
211-
id: dir
212-
working-directory: recipes/${{ matrix.slug }}
213-
run: |
214-
runtime=$(jq -r '.runtime // "static"' meta.json)
215-
if [ "$runtime" = "zero" ] && [ -f site/dist/sf.jsonc ]; then
216-
dir=site/dist
217-
elif [ "$runtime" = "zero" ] || [ "$runtime" = "functions" ]; then
218-
dir=site
219-
elif [ -d site/dist ]; then dir=site/dist
220-
elif [ -d site/build ]; then dir=site/build
221-
elif [ -d site/out ]; then dir=site/out
222-
else dir=site
223-
fi
224-
echo "dir=$dir" >> "$GITHUB_OUTPUT"
225-
if [ "$runtime" = "static" ]; then
226-
bun ../../scripts/validate-publish-dir.mjs "${{ matrix.slug }}" "$dir"
227-
fi
228-
- name: Publish Spacefast space
229-
if: github.event_name != 'pull_request'
230-
working-directory: recipes/${{ matrix.slug }}
231-
env:
232-
SPACEFAST_TOKEN: ${{ secrets.SPACEFAST_DEPLOY_KEY }}
233-
SPACEFAST_API_URL: https://api.spacefast.com
234-
run: |
235-
space_slug=$(jq -er '.publish_slug // .slug' meta.json)
236-
runtime=$(jq -r '.runtime // "static"' meta.json)
237-
publish_args=(
238-
"${{ steps.dir.outputs.dir }}"
239-
--team spacefast-examples
240-
--source-type git
241-
--git-repository "${{ github.repository }}"
242-
--git-branch "${{ github.ref_name }}"
243-
--git-commit "${{ github.sha }}"
244-
--wait
245-
--json
246-
)
247-
if [ "$runtime" = "zero" ]; then
248-
# The Build step already ran the framework build and `sf build`.
249-
publish_args+=(--skip-build)
250-
fi
251-
252-
set +e
253-
result=$(sf publish "${publish_args[@]}" --space "$space_slug" 2>&1)
254-
exit_code=$?
255-
set -e
256-
printf '%s\n' "$result"
257-
258-
if [ "$exit_code" -eq 0 ]; then
259-
exit 0
260-
fi
261-
if ! jq -e '.error.code == "not_found"' <<<"$result" >/dev/null; then
262-
exit "$exit_code"
263-
fi
264-
265-
sf publish "${publish_args[@]}" --slug "$space_slug"

‎README.md‎

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ server. `astro-zero/` needs both: Astro's dev server for the pages and
3838
| [`wp-react/`](./wp-react/) | A Vite + React SPA reading WordPress posts in the browser, with the `_redirects` SPA fallback |
3939
| [`unfurl/`](./unfurl/) | Next.js SSR, a route handler, and middleware on the Functions runtime |
4040
| [`trailhead/`](./trailhead/) | A Next.js static export with `@spacefast/image` Site Accelerator images, `_redirects`, and `_headers` |
41-
| [`recipes/`](./recipes/) | Canonical prompts, metadata, live outputs, and the public recipe feed |
4241
| [`kitchen-sink/`](./kitchen-sink/) | Zero, Pages, PHP, JavaScript, TypeScript, auth, mail, and routing in one project |
4342
| [`migrate-from-cloudflare-pages/`](./migrate-from-cloudflare-pages/) | Wrangler build settings and Pages convention files |
4443
| [`migrate-from-vercel/`](./migrate-from-vercel/) | `vercel.json` build, redirects, rewrites, headers, and cron import |
@@ -47,22 +46,11 @@ server. `astro-zero/` needs both: Astro's dev server for the pages and
4746
Each example README calls out the important files, the expected build output,
4847
and any product boundary that cannot be translated automatically.
4948

50-
## Recipes integration
51-
52-
`recipes/` is the source of truth for [spacefast.com/recipes](https://spacefast.com/recipes).
53-
Each recipe contains its copy-paste prompt, gallery metadata, runnable output,
54-
and live URL. GitHub Actions compiles those records into the historical public
55-
feed at <https://spacefast.github.io/examples/manifest.json> and publishes only
56-
changed recipe outputs.
57-
58-
Do not duplicate recipe prompts in another package or repository. Framework
59-
examples teach an integration; recipes are user-facing starting points that an
60-
agent can customize and publish.
61-
6249
## Validation
6350

64-
The pull-request workflow builds every top-level project through `sf build`,
65-
runs the Zero app tests, validates every recipe output, and builds the recipe
66-
manifest, without creating a live version. `migrate-from-netlify` builds its
67-
prebuilt output, because `sf build` has no flag to accept the Netlify features
68-
that still need a port.
51+
The pull-request workflow builds every top-level project through `sf build`
52+
and runs the Zero app tests, without creating a live version.
53+
`migrate-from-netlify` builds its prebuilt output, because `sf build` has no
54+
flag to accept the Netlify features that still need a port.
55+
56+
Recipe prompts live in their own repository and are published separately.

‎recipes/2048/README.md‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎recipes/2048/meta.json‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎recipes/2048/prompt.md‎

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)