Skip to content

Commit

Permalink
Merge pull request #1 from johnnygerard/deploy
Browse files Browse the repository at this point in the history
ci: add Firebase hosting config and deployment workflows
  • Loading branch information
johnnygerard committed May 22, 2024
2 parents 92c24aa + 317b015 commit cc43965
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "hello-world-f3218"
}
}
26 changes: 26 additions & 0 deletions .github/workflows/firebase-preview-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow's first version was auto-generated by the Firebase CLI.
# Firebase CLI repository: https://github.com/firebase/firebase-tools
# Command: firebase init hosting

name: Deploy to Firebase Hosting on PR
on: pull_request
permissions:
checks: write
contents: read
pull-requests: write
jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: "package.json"
cache: "npm"
- run: npm ci && npx ng version && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_HELLO_WORLD_F3218 }}
projectId: hello-world-f3218
25 changes: 25 additions & 0 deletions .github/workflows/firebase-production-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This workflow's first version was auto-generated by the Firebase CLI.
# Firebase CLI repository: https://github.com/firebase/firebase-tools
# Command: firebase init hosting

name: Deploy to Firebase Hosting on merge
on:
push:
branches:
- main
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: "package.json"
cache: "npm"
- run: npm ci && npx ng version && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_HELLO_WORLD_F3218 }}
channelId: live
projectId: hello-world-f3218
13 changes: 12 additions & 1 deletion firebase.json
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
{}
{
"hosting": {
"public": "dist/fb-hello-world/browser",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}

0 comments on commit cc43965

Please sign in to comment.