Skip to content

Commit 9d82e68

Browse files
committed
build: switch to canonical dev-infra GCP project for previews
Instead of using `ng-comp-dev` we plan on using a single canonical preview GCP project owned by dev-infra. This will help with quota management for preview channels and also makes billing easier.
1 parent dabe2e1 commit 9d82e68

File tree

2 files changed

+40
-26
lines changed

2 files changed

+40
-26
lines changed

.github/workflows/deploy-dev-app.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,28 @@ permissions:
1616
# Needed in order to be able to comment on the pull request.
1717
pull-requests: write
1818

19+
env:
20+
PREVIEW_PROJECT: ng-dev-previews
21+
PREVIEW_SITE: ng-dev-previews-comp
22+
1923
jobs:
2024
deploy-dev-app:
2125
runs-on: ubuntu-latest
2226
if: ${{ github.event.workflow_run.conclusion == 'success' }}
2327
steps:
2428
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.0.0
29+
30+
- name: Configure Firebase deploy target
31+
run: |
32+
# We can use `npx` as the Firebase deploy actions uses it too.
33+
npx -y firebase-tools@latest target:clear --project ${{env.PREVIEW_PROJECT}} hosting dev-app
34+
npx -y firebase-tools@latest target:apply --project ${{env.PREVIEW_PROJECT}} hosting dev-app ${{env.PREVIEW_SITE}}
35+
2536
- uses: angular/dev-infra/github-actions/deploy-previews/upload-artifacts-to-firebase@0a49ed85541ecbb28a0e19eefce7a874c1eaab5e
2637
with:
2738
github-token: '${{secrets.GITHUB_TOKEN}}'
2839
workflow-artifact-name: 'dev-app'
2940
firebase-config-dir: './'
3041
firebase-public-dir: './dist/dev-app-web-pkg'
31-
firebase-project-id: 'ng-comp-dev'
42+
firebase-project-id: '${{env.PREVIEW_PROJECT}}'
3243
firebase-service-key: '${{secrets.FIREBASE_PREVIEW_SERVICE_TOKEN}}'

firebase.json

+28-25
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
{
2-
"hosting": {
3-
"public": "dist/dev-app-web-pkg",
4-
"rewrites": [
5-
{
6-
"source": "/**/!(*.@(js|ts|html|css|json|svg|png|jpg|jpeg))",
7-
"destination": "/index.html"
8-
}
9-
],
10-
"headers": [
11-
{
12-
"source": "*",
13-
"headers": [
14-
{
15-
"key": "Cache-Control",
16-
"value": "no-cache"
17-
},
18-
{
19-
"key": "X-Frame-Options",
20-
"value": "DENY"
21-
}
22-
]
23-
}
24-
],
25-
"ignore": ["firebase.json"]
26-
}
2+
"hosting": [
3+
{
4+
"target": "dev-app",
5+
"public": "dist/dev-app-web-pkg",
6+
"rewrites": [
7+
{
8+
"source": "/**/!(*.@(js|ts|html|css|json|svg|png|jpg|jpeg))",
9+
"destination": "/index.html"
10+
}
11+
],
12+
"headers": [
13+
{
14+
"source": "*",
15+
"headers": [
16+
{
17+
"key": "Cache-Control",
18+
"value": "no-cache"
19+
},
20+
{
21+
"key": "X-Frame-Options",
22+
"value": "DENY"
23+
}
24+
]
25+
}
26+
],
27+
"ignore": ["firebase.json"]
28+
}
29+
]
2730
}

0 commit comments

Comments
 (0)