diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 0000000..c590d00 --- /dev/null +++ b/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "gen-lang-client-0879285190" + } +} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..7f3a516 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,52 @@ +name: Build and Deploy to Firebase Hosting + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build_and_deploy: + name: Build and Deploy + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + + steps: + - name: Checkout repository + 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 application + run: npm run build + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + + - name: Deploy to Firebase Hosting (Preview) + if: github.event_name == 'pull_request' + uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: ${{ secrets.GITHUB_TOKEN }} + firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} + projectId: gen-lang-client-0879285190 + + - name: Deploy to Firebase Hosting (Live) + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: ${{ secrets.GITHUB_TOKEN }} + firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} + projectId: gen-lang-client-0879285190 + channelId: live diff --git a/firebase.json b/firebase.json new file mode 100644 index 0000000..04e9155 --- /dev/null +++ b/firebase.json @@ -0,0 +1,27 @@ +{ + "hosting": { + "public": "dist/app/browser", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ], + "headers": [ + { + "source": "**/*.@(js|css|mjs)", + "headers": [ + { + "key": "Cache-Control", + "value": "max-age=31536000" + } + ] + } + ] + } +}