Skip to content

Commit

Permalink
feat: firebase hosting deploy by github actions (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
abc873693 authored Nov 25, 2024
1 parent 170a689 commit 810c618
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/workflows/gitpage.yaml → .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,26 @@ jobs:
git checkout -b gh-pages
git add .
git commit -m "gitpage by CI"
git push --force secure-origin gh-pages
git push --force secure-origin gh-pages
firebase-hosting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: build
run: |
npm ci
npx ng add angular-cli-ghpages --skip-confirmation
npx ng build --base-href=/2024/
- name: lint
run: npm run lint
- name: Deploy to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
with:
entryPoint: "./"
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
projectId: "${{ secrets.PROJECT_ID }}"
channelId: live
34 changes: 34 additions & 0 deletions .github/workflows/preview-pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy to Firebase Hosting on PR

on:
pull_request:
branches:
- main
paths:
- '.github/workflows/preview-pull-request.yaml'
- '**'

jobs:
deploy_web:
name: Web Firebase Hosting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: build
run: |
npm ci
npx ng add angular-cli-ghpages --skip-confirmation
npx ng build --base-href=/2024/
- name: lint
run: npm run lint
- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
entryPoint: "./"
repoToken: "${{ secrets.GITHUB_TOKEN }}"
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
projectId: "${{ secrets.PROJECT_ID }}"
channelId: ${{ github.head_ref }}
19 changes: 19 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"hosting": [
{
"site": "devfest-taipei-3cb0a",
"public": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
]
}

0 comments on commit 810c618

Please sign in to comment.