Skip to content

Commit c8ffcf5

Browse files
committed
ci: automatically deploy dev-app to firebase for main branch
Automatically deploys the dev-app to firebase for pushes to the `main` branch. Note: not using `material2-dev` as it would complicate automated deployement as service key creation is limited given the project being a 1P-managed GCP project.
1 parent ec9581c commit c8ffcf5

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Deploying dev-app to Firebase [main push].
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions: {}
8+
9+
env:
10+
PREVIEW_PROJECT: ng-dev-previews
11+
PREVIEW_SITE: ng-dev-previews-comp
12+
PREVIEW_CHANNEL: main-branch
13+
14+
jobs:
15+
deploy-material2-dev:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Initialize environment
19+
uses: angular/dev-infra/github-actions/npm/checkout-and-setup-node@fb30926790c6225d553b91a4818cab2fdde4fb4e
20+
with:
21+
cache-node-modules: true
22+
- name: Setup Bazel
23+
uses: angular/dev-infra/github-actions/bazel/setup@fb30926790c6225d553b91a4818cab2fdde4fb4e
24+
- name: Setup Bazel RBE
25+
uses: angular/dev-infra/github-actions/bazel/configure-remote@fb30926790c6225d553b91a4818cab2fdde4fb4e
26+
27+
- run: yarn -s deploy-dev-app
28+
29+
- name: Configure Firebase deploy target
30+
run: |
31+
# We can use `npx` as the Firebase deploy actions uses it too.
32+
npx -y firebase-tools@latest target:clear --project ${{env.PREVIEW_PROJECT}} hosting dev-app
33+
npx -y firebase-tools@latest target:apply --project ${{env.PREVIEW_PROJECT}} hosting dev-app ${{env.PREVIEW_SITE}}
34+
35+
- uses: FirebaseExtended/action-hosting-deploy@638d3c162747cead0c1c0d3093208ed59dfd8231 # v0
36+
id: deploy
37+
with:
38+
# Note: No token used here as the action otherwise may attempt to post a comment.
39+
repoToken: ''
40+
firebaseServiceAccount: '${{secrets.FIREBASE_PREVIEW_SERVICE_TOKEN}}'
41+
projectId: '${{env.PREVIEW_PROJECT}}'
42+
channelId: '${{env.PREVIEW_CHANNEL}}'
43+
44+
- name: Result
45+
run: |
46+
echo "Deployed to: ${{steps.deploy.outputs.details_url}}"

0 commit comments

Comments
 (0)