fix: improve dependency installation in demo deployment workflow #2
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
| name: Deploy Demo (Next.js static export) to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| - name: Install dependencies (use lockfile if present) | |
| run: | | |
| if [ -f package-lock.json ]; then | |
| echo "Using npm ci with package-lock.json"; | |
| npm ci; | |
| else | |
| echo "No package-lock.json found. Falling back to npm install"; | |
| npm install; | |
| fi | |
| - name: Build demo for GitHub Pages | |
| run: npm run build:gh --workspace=@crest-ui/demo | |
| - name: Upload static site | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: apps/demo/out | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 |