Skip to content

Commit 76f9d7a

Browse files
committed
Add GitHub Actions workflow for Firebase deployment
- Create automated build and deploy workflow for main branch - Uses Firebase service account stored in GitHub secrets - Builds Astro site and deploys to Firebase Hosting - Includes Plausible analytics tracking code in production build
1 parent f0164e6 commit 76f9d7a

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build and Deploy to Firebase
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Build Astro site
26+
run: npm run build
27+
28+
- name: Create service account file
29+
run: echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}' > $HOME/gcloud-service-key.json
30+
31+
- name: Deploy to Firebase
32+
run: |
33+
npm install -g firebase-tools
34+
firebase deploy --only hosting --non-interactive
35+
env:
36+
GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/gcloud-service-key.json

0 commit comments

Comments
 (0)