fix landing page #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Workflow for deploying both Svelte 5 and legacy docs to GitHub Pages | |
| name: Deploy Multi-Version Docs | |
| on: | |
| push: | |
| branches: ["svelte5", "main"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| # Build Svelte 5 version | |
| - name: Checkout svelte5 branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: svelte5 | |
| path: svelte5-src | |
| - name: Install dependencies (svelte5) | |
| working-directory: svelte5-src | |
| run: npm ci | |
| # First build: landing page at root base path | |
| - name: Build landing page | |
| working-directory: svelte5-src | |
| env: | |
| BASE_PATH: /svelte-contain-css | |
| NODE_ENV: production | |
| run: npm run build | |
| - name: Save landing page | |
| run: | | |
| mkdir -p landing-build | |
| echo "=== Contents of build folder ===" | |
| ls -la svelte5-src/build/ | |
| # SvelteKit builds /landing route as landing.html, rename to index.html | |
| cp svelte5-src/build/landing.html landing-build/index.html | |
| # Also grab the _app assets needed for the landing page | |
| cp -r svelte5-src/build/_app landing-build/_app | |
| # Second build: full svelte5 docs | |
| - name: Build svelte5 docs | |
| working-directory: svelte5-src | |
| env: | |
| BASE_PATH: /svelte-contain-css/svelte5 | |
| NODE_ENV: production | |
| run: npm run build | |
| # Build legacy version | |
| - name: Checkout main branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| path: legacy-src | |
| - name: Install dependencies (legacy) | |
| working-directory: legacy-src | |
| run: npm ci | |
| - name: Patch legacy config for BASE_PATH support | |
| working-directory: legacy-src | |
| run: | | |
| sed -i 's#base: "/svelte-contain-css"#base: process.env.BASE_PATH || "/svelte-contain-css"#' svelte.config.js | |
| - name: Build legacy docs | |
| working-directory: legacy-src | |
| env: | |
| BASE_PATH: /svelte-contain-css/legacy | |
| NODE_ENV: production | |
| run: npm run build | |
| # Combine builds | |
| - name: Create combined output | |
| run: | | |
| mkdir -p combined | |
| # Copy landing page to root | |
| cp -r landing-build/* combined/ | |
| # Copy version-specific docs | |
| cp -r svelte5-src/build combined/svelte5 | |
| cp -r legacy-src/build combined/legacy | |
| - name: Add .nojekyll | |
| run: touch combined/.nojekyll | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: combined | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |