-
Notifications
You must be signed in to change notification settings - Fork 3
Integrate Firebase Hosting for automated deployment (#45) #60
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
Changes from all commits
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": "servio-app" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Deploy to Firebase Hosting | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: firebase-deploy-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-and-deploy: | ||
| name: Build & Deploy | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: npm | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Build | ||
| run: npm run build | ||
| env: | ||
| VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }} | ||
| VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }} | ||
| VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }} | ||
| VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }} | ||
| VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }} | ||
| VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }} | ||
| VITE_FIREBASE_MEASUREMENT_ID: ${{ secrets.VITE_FIREBASE_MEASUREMENT_ID }} | ||
|
|
||
| - name: Deploy to Firebase Hosting | ||
| uses: FirebaseExtended/action-hosting-deploy@v0 | ||
| with: | ||
| repoToken: ${{ secrets.GITHUB_TOKEN }} | ||
| firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | ||
| channelId: live | ||
| projectId: ${{ secrets.VITE_FIREBASE_PROJECT_ID }} | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,50 @@ | ||||||||||||||
| name: Firebase Hosting Preview | ||||||||||||||
|
|
||||||||||||||
| on: | ||||||||||||||
| pull_request: | ||||||||||||||
|
|
||||||||||||||
| permissions: | ||||||||||||||
| contents: read | ||||||||||||||
| checks: write | ||||||||||||||
| pull-requests: write | ||||||||||||||
|
|
||||||||||||||
| concurrency: | ||||||||||||||
| group: firebase-preview-${{ github.event.pull_request.number }} | ||||||||||||||
| cancel-in-progress: true | ||||||||||||||
|
|
||||||||||||||
| jobs: | ||||||||||||||
| preview: | ||||||||||||||
| if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | ||||||||||||||
| name: Build & Preview | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
|
|
||||||||||||||
| steps: | ||||||||||||||
| - name: Checkout | ||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||
|
Comment on lines
+22
to
+23
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. Pin GitHub Actions to specific commit hashes for supply-chain security. Same unpinned action issue as the production workflow. Apply the same hashes to ensure consistency across workflows. 🔒 Proposed fixes for pinned action hashes - name: Checkout
- uses: actions/checkout@v4
+ uses: actions/checkout@a5ac7e51b41094c7f3ba2a8547355d5e79c575f7 # v4.1.6 - name: Set up Node.js
- uses: actions/setup-node@v4
+ uses: actions/setup-node@60edb5dd545a775178fac7f3ba2a8547355d5e79c575f7 # v4.0.2 - name: Deploy Preview to Firebase Hosting
- uses: FirebaseExtended/action-hosting-deploy@v0
+ uses: FirebaseExtended/action-hosting-deploy@16cfa59e21b9e3a2e23a41e4f0420a42a1c6ef30 # v0.8.1Note: Use the same pinned versions as the production workflow to keep CI/CD consistent. Also applies to: 25-29, 46-50 🧰 Tools🪛 zizmor (1.25.2)[warning] 22-23: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 23-23: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI AgentsSource: Linters/SAST tools Add Same security concern as production workflow: checkout leaves Git credentials in git config. 🔐 Proposed fix - name: Checkout
uses: actions/checkout@v4
+ with:
+ persist-credentials: false📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.25.2)[warning] 22-23: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 23-23: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| - name: Set up Node.js | ||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||
| with: | ||||||||||||||
| node-version: 20 | ||||||||||||||
| cache: npm | ||||||||||||||
|
|
||||||||||||||
| - name: Install dependencies | ||||||||||||||
| run: npm ci | ||||||||||||||
|
|
||||||||||||||
| - name: Build | ||||||||||||||
| run: npm run build | ||||||||||||||
| env: | ||||||||||||||
| VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }} | ||||||||||||||
| VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }} | ||||||||||||||
| VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }} | ||||||||||||||
| VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }} | ||||||||||||||
| VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }} | ||||||||||||||
| VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }} | ||||||||||||||
| VITE_FIREBASE_MEASUREMENT_ID: ${{ secrets.VITE_FIREBASE_MEASUREMENT_ID }} | ||||||||||||||
|
|
||||||||||||||
| - name: Deploy Preview to Firebase Hosting | ||||||||||||||
| uses: FirebaseExtended/action-hosting-deploy@v0 | ||||||||||||||
| with: | ||||||||||||||
| repoToken: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||
| firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | ||||||||||||||
| projectId: ${{ secrets.VITE_FIREBASE_PROJECT_ID }} | ||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "hosting": { | ||
| "public": "dist", | ||
| "ignore": [ | ||
| "firebase.json", | ||
| "**/.*", | ||
| "**/node_modules/**" | ||
| ], | ||
| "rewrites": [ | ||
| { | ||
| "source": "**", | ||
| "destination": "/index.html" | ||
| } | ||
| ], | ||
| "headers": [ | ||
| { | ||
| "source": "/assets/**", | ||
| "headers": [ | ||
| { | ||
| "key": "Cache-Control", | ||
| "value": "public, max-age=31536000, immutable" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "source": "**/*.@(js|css)", | ||
| "headers": [ | ||
| { | ||
| "key": "Cache-Control", | ||
| "value": "public, max-age=31536000, immutable" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } |
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.
Pin GitHub Actions to specific commit hashes for supply-chain security.
Three actions are unpinned (
@v4and@v0tags). Tags can be moved or compromised; pin to immutable commit hashes to ensure reproducible, auditable CI/CD.🔒 Proposed fixes for pinned action hashes
Note: Verify these are the latest compatible versions by checking the action repositories before merging. Use the
@actions/or Firebase release tags to find the exact commit hash for each version.Also applies to: 25-28, 45-50
🧰 Tools
🪛 zizmor (1.25.2)
[warning] 21-22: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 22-22: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents
Source: Linters/SAST tools
Add
persist-credentials: falseto prevent credential leakage.The checkout action leaves Git credentials in the workflow's git config, which could be exposed in logs or artifacts if a later step is compromised.
🔐 Proposed fix
- name: Checkout uses: actions/checkout@v4 + with: + persist-credentials: false🧰 Tools
🪛 zizmor (1.25.2)
[warning] 21-22: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 22-22: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents