Skip to content

Commit 39f5434

Browse files
committed
build: update github action for deploy
1 parent 7d77819 commit 39f5434

2 files changed

Lines changed: 25 additions & 21 deletions

File tree

.github/workflows/deploy-stories.yml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deploy Stories to GitHub Pages
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, feat/next]
66
workflow_dispatch:
77

88
permissions:
@@ -38,51 +38,55 @@ jobs:
3838
- name: Build module
3939
run: pnpm build
4040

41-
# ── Frame app (playground/) ─────────────────────────────────────────────
42-
# Generates the component renderer routes at /-frame/**
41+
# ── Playground dependencies ─────────────────────────────────────────────
4342

44-
- name: Install frame app dependencies
43+
- name: Install playground dependencies
4544
working-directory: playground
4645
run: pnpm install
4746

48-
- name: Generate frame app
47+
# ── Frame pass ──────────────────────────────────────────────────────────
48+
# Generates the component renderer routes at /-frame/**
49+
# NUXT_STORIES_MODE overrides the mode option so the same nuxt.config is reused.
50+
51+
- name: Generate frame output
4952
working-directory: playground
5053
run: pnpm nuxi generate
5154
env:
55+
NUXT_STORIES: "1"
5256
NUXT_STORIES_MODE: frame
53-
# Set to your GitHub Pages base path, e.g. /nuxt-stories/ for
54-
# https://rezozero.github.io/nuxt-stories/
57+
# Base path matching the GitHub Pages URL: https://rezozero.github.io/nuxt-stories/
5558
NUXT_APP_BASE_URL: /nuxt-stories/
5659

57-
# ── Shell app (playground/stories/) ────────────────────────────────────
58-
# Generates the stories UI (nav, iframe wrapper)
60+
- name: Save frame output
61+
run: mv playground/.output/public playground/.output/frame-public
5962

60-
- name: Install shell app dependencies
61-
working-directory: playground/stories
62-
run: pnpm install
63+
# ── Shell pass ──────────────────────────────────────────────────────────
64+
# Generates the stories UI (nav + iframe wrapper)
6365

64-
- name: Generate shell app
65-
working-directory: playground/stories
66+
- name: Generate shell output
67+
working-directory: playground
6668
run: pnpm nuxi generate
6769
env:
70+
NUXT_STORIES: "1"
71+
NUXT_STORIES_MODE: shell
6872
NUXT_APP_BASE_URL: /nuxt-stories/
6973

7074
# ── Merge outputs ───────────────────────────────────────────────────────
71-
# Copy the frame app's /-frame/** output into the shell's output so both
72-
# are served from the same origin (required for same-origin postMessage).
75+
# Copy the frame output's /-frame/** into the shell output so both are
76+
# served from the same origin (required for same-origin postMessage).
7377

7478
- name: Merge frame output into shell output
7579
run: |
76-
cp -r playground/.output/public/-frame playground/stories/.output/public/-frame
80+
cp -r playground/.output/frame-public/-frame playground/.output/public/-frame
7781
7882
# GitHub Pages ignores folders prefixed with _ by default; .nojekyll disables this.
7983
- name: Add .nojekyll
80-
run: touch playground/stories/.output/public/.nojekyll
84+
run: touch playground/.output/public/.nojekyll
8185

8286
- name: Upload Pages artifact
8387
uses: actions/upload-pages-artifact@v3
8488
with:
85-
path: playground/stories/.output/public
89+
path: playground/.output/public
8690

8791
deploy:
8892
needs: build

src/module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ export default defineNuxtModule<NuxtStoriesOptions>({
8787
const pattern = options.pattern || '**/*.stories.vue'
8888
const root = options.root || ['components', 'stories']
8989

90-
// Allow the spawned frame process to override mode via env var
91-
const mode = options.mode || 'all'
90+
// Allow the spawned frame process (or CI) to override mode via env var
91+
const mode = (process.env.NUXT_STORIES_MODE as 'shell' | 'frame' | 'all' | undefined) || options.mode || 'all'
9292

9393
// Always enable the pages module – the module adds routes via extendPages
9494
// regardless of whether an app/pages/ directory exists.

0 commit comments

Comments
 (0)