fix: GitHub Pages deployment workflow improvements #39
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| setup: | |
| name: Setup | |
| runs-on: ubuntu-latest | |
| outputs: | |
| cache-hit: ${{ steps.cache-node-modules.outputs.cache-hit }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| - id: cache-node-modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| packages/*/node_modules | |
| docs/node_modules | |
| key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-modules- | |
| - id: cache-turbo | |
| uses: actions/cache@v4 | |
| with: | |
| path: .turbo | |
| key: ${{ runner.os }}-turbo-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-turbo- | |
| # Always run install to ensure all dependencies are available | |
| # This ensures workspace packages like docs have their dependencies | |
| - run: pnpm install --frozen-lockfile | |
| validate: | |
| name: Validate | |
| needs: setup | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'pnpm' | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| packages/*/node_modules | |
| docs/node_modules | |
| key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-modules- | |
| - uses: actions/cache@v4 | |
| with: | |
| path: .turbo | |
| key: ${{ runner.os }}-turbo-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-turbo- | |
| - run: pnpm turbo run lint --affected | |
| - run: pnpm turbo run type-check --affected | |
| - run: pnpm turbo run build --affected | |
| - run: pnpm turbo run test --affected | |
| # Debug: Check what was built | |
| - name: Check build output | |
| run: | | |
| echo "Checking packages directory structure:" | |
| find packages -name "dist" -type d || echo "No dist directories found" | |
| ls -la packages/*/dist 2>/dev/null || echo "No dist directories to list" | |
| - uses: actions/upload-artifact@v4 | |
| if: success() | |
| with: | |
| name: build-artifacts | |
| path: packages/*/dist | |
| if-no-files-found: warn | |
| cache-build: | |
| name: Cache Artifacts | |
| needs: validate | |
| runs-on: ubuntu-latest | |
| if: success() | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| id: download-artifacts | |
| continue-on-error: true | |
| with: | |
| name: build-artifacts | |
| path: packages | |
| - name: Check artifact download | |
| run: | | |
| if [[ "${{ steps.download-artifacts.outcome }}" == "success" ]]; then | |
| echo "Artifacts downloaded successfully" | |
| ls -la packages/ | |
| else | |
| echo "No artifacts to download - this may be expected if no packages were built" | |
| fi | |
| - uses: actions/cache@v4 | |
| if: steps.download-artifacts.outcome == 'success' | |
| with: | |
| path: packages/*/dist | |
| key: build-artifacts-${{ github.sha }} |