Skip to content

Commit 18664ed

Browse files
authored
build: switch to new preview deploy github action (#26117)
Most of the action logic has been extracted for more reusability, so that can also leverage this setup for AIO previews.
1 parent dab1930 commit 18664ed

File tree

3 files changed

+13
-80
lines changed

3 files changed

+13
-80
lines changed

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.0.0
2626
- uses: ./.github/actions/yarn-install
2727

28-
- uses: angular/dev-infra/github-actions/setup-bazel-remote-exec@a818bed04b1cf671f9af4f61331b12250da39a49
28+
- uses: angular/dev-infra/github-actions/setup-bazel-remote-exec@eba7bac8f0c7afd20cf63d48de1942d06efd0972
2929
with:
3030
bazelrc: ./.bazelrc.user
3131

@@ -34,17 +34,9 @@ jobs:
3434
# the number of concurrent actions is determined based on the host resources.
3535
- run: bazel build //src/dev-app:web_package --symlink_prefix=dist/ --jobs=32
3636

37-
# Prepare the workflow artifact that is available for the deploy workflow. We store the pull
38-
# request number and SHA in a file that can be read by the deploy workflow. This is necessary
39-
# so that the deploy workflow can create a comment on the PR that triggered the deploy.
40-
- run: |
41-
mkdir -p dist/devapp
42-
cp -R dist/bin/src/dev-app/web_package/* dist/devapp
43-
echo ${{github.event.pull_request.number}} > dist/devapp/pr_number
44-
echo ${{github.event.pull_request.head.sha}} > dist/devapp/pr_sha
45-
46-
# Upload the generated dev-app archive.
47-
- uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # renovate: tag=v2.0.0
37+
- uses: angular/dev-infra/github-actions/deploy-previews/pack-and-upload-artifact@eba7bac8f0c7afd20cf63d48de1942d06efd0972
4838
with:
49-
name: devapp
50-
path: dist/devapp
39+
workflow-artifact-name: 'dev-app'
40+
pull-number: '${{github.event.pull_request.number}}'
41+
artifact-build-revision: '${{github.event.pull_request.head.sha}}'
42+
deploy-directory: './dist/bin/src/dev-app/web_package/'

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

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,11 @@ jobs:
2222
if: ${{ github.event.workflow_run.conclusion == 'success' }}
2323
steps:
2424
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2.0.0
25-
- uses: ./.github/actions/yarn-install
26-
27-
- name: 'Download artifact from build job'
28-
run: |
29-
./scripts/github/fetch-workflow-artifact.mjs ${{secrets.GITHUB_TOKEN}} \
30-
${{github.event.workflow_run.id}} devapp > devapp.zip
31-
32-
- name: Extracting workflow artifact into Firebase public directory.
33-
run: |
34-
mkdir -p dist/dev-app-web-pkg
35-
unzip devapp.zip -d dist/dev-app-web-pkg
36-
37-
- name: Extracting pull request from extracted workflow artifact.
38-
id: pr_info
39-
run: |
40-
echo "::set-output name=number::$(cat ./dist/dev-app-web-pkg/pr_number)"
41-
echo "::set-output name=sha::$(cat ./dist/dev-app-web-pkg/pr_sha)"
42-
43-
- uses: FirebaseExtended/action-hosting-deploy@276388dd6c2cde23455b30293105cc866c22282d # renovate: tag=v0.0.0
44-
id: deploy
45-
with:
46-
repoToken: '${{secrets.GITHUB_TOKEN}}'
47-
firebaseServiceAccount: '${{secrets.FIREBASE_PREVIEW_SERVICE_TOKEN}}'
48-
expires: 20d
49-
projectId: ng-comp-dev
50-
channelId: pr-${{steps.pr_info.outputs.number}}-${{steps.pr_info.outputs.sha}}
51-
52-
- uses: marocchino/sticky-pull-request-comment@39c5b5dc7717447d0cba270cd115037d32d28443 # renovate: tag=v2.0.0
25+
- uses: angular/dev-infra/github-actions/deploy-previews/upload-artifacts-to-firebase@eba7bac8f0c7afd20cf63d48de1942d06efd0972
5326
with:
54-
message: |
55-
Deployed dev-app to: ${{ steps.deploy.outputs.details_url }}
56-
number: ${{ steps.pr_info.outputs.number }}
27+
github-token: '${{secrets.GITHUB_TOKEN}}'
28+
workflow-artifact-name: 'dev-app'
29+
firebase-config-dir: './'
30+
firebase-public-dir: './dist/dev-app-web-pkg'
31+
firebase-project-id: 'ng-comp-dev'
32+
firebase-service-key: '${{secrets.FIREBASE_PREVIEW_SERVICE_TOKEN}}'

scripts/github/fetch-workflow-artifact.mjs

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)