Skip to content

Commit abd8414

Browse files
authored
build(preview): use angular/dev-infra for preview deployment (#991)
Using the same actions as the original adev.
1 parent 58f44e9 commit abd8414

File tree

2 files changed

+12
-45
lines changed

2 files changed

+12
-45
lines changed

.github/workflows/adev-preview-build.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,9 @@ jobs:
4545
common --color=yes
4646
- run: yarn install
4747
- run: yarn build
48-
- run: chmod 755 build/dist/bin/adev/build/browser
49-
- name: Inject pull request number
50-
run: echo "${{ github.event.pull_request.number }}" >> __metadata__pull_number.txt
51-
working-directory: build/dist/bin/adev/build/browser
52-
- uses: actions/upload-artifact@v4
48+
- uses: angular/dev-infra/github-actions/previews/pack-and-upload-artifact@53fb7c37cf14343f14ed79e2fefbbb2489ead4ee
5349
with:
54-
name: adev-preview
55-
path: build/dist/bin/adev/build/browser
50+
workflow-artifact-name: 'adev-preview'
51+
pull-number: '${{ github.event.pull_request.number }}'
52+
artifact-build-revision: '${{github.event.pull_request.head.sha}}'
53+
deploy-directory: './build/dist/bin/adev/build/browser'

.github/workflows/adev-preview-deploy.yml

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,50 +22,19 @@ permissions:
2222

2323
env:
2424
BUILD_DIR: build/dist/bin/adev/build/browser
25+
PREVIEW_PROJECT: angular-ja
2526

2627
jobs:
2728
deploy:
2829
runs-on: ubuntu-latest
2930
if: ${{ github.event.workflow_run.conclusion == 'success' }}
3031
steps:
3132
- uses: actions/checkout@v4
32-
- name: Download adev preview artifact from previous workflow run
33-
uses: actions/download-artifact@v4
33+
- uses: angular/dev-infra/github-actions/previews/upload-artifacts-to-firebase@53fb7c37cf14343f14ed79e2fefbbb2489ead4ee
3434
with:
35-
name: adev-preview
36-
path: ${{ env.BUILD_DIR }}
3735
github-token: '${{secrets.GITHUB_TOKEN}}'
38-
run-id: ${{ github.event.workflow_run.id }}
39-
- name: Extract pull request number
40-
id: pr-number
41-
run: |
42-
PR_NUMBER=$(cat ./$BUILD_DIR/__metadata__pull_number.txt)
43-
echo 'value=$PR_NUMBER' >> $GITHUB_OUTPUT
44-
- name: Deploy to Firebase Hosting Preview
45-
id: firebase-deploy
46-
uses: FirebaseExtended/[email protected]
47-
with:
48-
repoToken: "${{ secrets.GITHUB_TOKEN }}"
49-
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
50-
projectId: angular-ja
51-
channelId: pr-${{ steps.pr-number.outputs.value }}
52-
expires: 7d
53-
disableComment: true
54-
- name: Find Comment
55-
uses: peter-evans/find-comment@v3
56-
id: find-comment
57-
with:
58-
token: ${{ secrets.GITHUB_TOKEN }}
59-
issue-number: ${{ steps.pr-number.outputs.value }}
60-
comment-author: 'github-actions[bot]'
61-
body-includes: 'Preview deployed'
62-
- name: Comment on pull request
63-
uses: peter-evans/create-or-update-comment@v4
64-
with:
65-
token: ${{ secrets.GITHUB_TOKEN }}
66-
issue-number: ${{ steps.pr-number.outputs.value }}
67-
comment-id: ${{ steps.find-comment.outputs.comment-id }}
68-
edit-mode: replace
69-
body: |
70-
Preview deployed: ${{ steps.firebase-deploy.outputs.details_url }} (commit: ${{ github.event.workflow_run.head_sha }})
71-
36+
workflow-artifact-name: 'adev-preview'
37+
firebase-config-dir: './'
38+
firebase-public-dir: './adev/build/browser'
39+
firebase-project-id: '${{env.PREVIEW_PROJECT}}'
40+
firebase-service-key: '${{secrets.FIREBASE_SERVICE_ACCOUNT}}'

0 commit comments

Comments
 (0)