-
Notifications
You must be signed in to change notification settings - Fork 10
Trying Firebase Hosting for developer-docs #535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
1a7a837
f3b30f6
7556da5
34d4921
403ba82
eb3c75d
33ef6e4
4bdc88c
1300f6c
bfbcbad
53e41ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "projects": { | ||
| "default": "docs-scalekit-com" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # This file was auto-generated by the Firebase CLI | ||
| # https://github.com/firebase/firebase-tools | ||
|
|
||
| name: Deploy to Firebase Hosting on PR | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, labeled] | ||
| permissions: | ||
| checks: write | ||
| contents: read | ||
| pull-requests: write | ||
| jobs: | ||
| build_and_preview: | ||
| if: | | ||
| github.event.pull_request.head.repo.full_name == github.repository && | ||
| github.event.pull_request.draft == false && | ||
| contains(github.event.pull_request.labels.*.name, 'firebase-preview') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22' | ||
| - run: npm install -g pnpm | ||
| - uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.local/share/pnpm/store | ||
| key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | ||
| restore-keys: ${{ runner.os }}-pnpm- | ||
|
Comment on lines
+25
to
+29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify pnpm store path on Ubuntu
# Install pnpm and check the actual store path
npm install -g pnpm@10
pnpm store pathRepository: scalekit-inc/developer-docs Length of output: 1937 🏁 Script executed: cat -n .github/workflows/firebase-hosting-pull-request.yml | head -50Repository: scalekit-inc/developer-docs Length of output: 1528 🏁 Script executed: # Search for pnpm/action-setup usage in the workflow
rg "pnpm/action-setup" .github/workflows/Repository: scalekit-inc/developer-docs Length of output: 53 🌐 Web query:
💡 Result: The best practice for handling the pnpm store cache path in GitHub Actions with pnpm/action-setup is to use the built-in cache: true input on the action itself (available in v4+), which automatically detects and caches the pnpm store path (typically under the action's dest directory, like ~/setup-pnpm/.../store/v3, or the global default like ~/.local/share/pnpm/store depending on pnpm version and config). The action handles pruning via post-action. Example from official docs: - uses: pnpm/action-setup@v4 with: version: 10 cache: true - run: pnpm install Note: No need for manual actions/cache or pnpm store path; the action manages it. Post-action prunes the store. Alternative (widely recommended, used in pnpm.io CI docs): Leverage actions/setup-node with cache: 'pnpm' AFTER pnpm/action-setup (with run_install: false). This uses setup-node's automatic detection of store path via pnpm store path --silent. Example: - uses: pnpm/action-setup@v4 with: version: 10 run_install: false - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - run: pnpm install This caches only the store (not node_modules). For node_modules caching, add manual actions/cache on ./node_modules. Avoid manual store path fetching unless customizing (e.g., env PNPM_STORE_DIR). Use hashFiles('/pnpm-lock.yaml') for cache keys. Recent pnpm versions (v8+) default store to XDG-compliant paths like ~/.local/share/pnpm/store. Prefer setup-node method for simplicity/maintenance (handles pnpm changes); use action's cache: true for standalone pnpm setup without node action. Citations:
Use The cache path 🤖 Prompt for AI Agents |
||
| - run: pnpm install | ||
| - run: pnpm build | ||
| - uses: FirebaseExtended/action-hosting-deploy@v0 | ||
| with: | ||
| repoToken: ${{ secrets.GITHUB_TOKEN }} | ||
| firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_DOCS_SCALEKIT_COM }} | ||
| projectId: docs-scalekit-com | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,3 +45,4 @@ skills-lock.json | |
|
|
||
| .windsurf/ | ||
| .tmp/ | ||
| .firebase/ | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,6 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "hosting": { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "public": "dist", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "ignore": ["firebase.json", "**/.*", "**/node_modules/**"] | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+6
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider adding rewrite rules and cache headers for production readiness. The basic hosting configuration is correct—
♻️ Suggested enhanced configuration {
"hosting": {
"public": "dist",
- "ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
+ "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
+ "headers": [
+ {
+ "source": "**/*.@(js|css|woff2|png|jpg|webp|svg|gif)",
+ "headers": [
+ {
+ "key": "Cache-Control",
+ "value": "public, max-age=31536000, immutable"
+ }
+ ]
+ }
+ ]
}
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Pin pnpm version to ensure consistent builds.
The unpinned
npm install -g pnpmcould install any version. Per CONTRIBUTING.md, the project requires pnpm ≥ 10. Pin the version to prevent potential breaking changes from future pnpm releases.♻️ Proposed fix
Alternatively, use the official pnpm action which handles caching automatically:
📝 Committable suggestion
🤖 Prompt for AI Agents