-
Notifications
You must be signed in to change notification settings - Fork 36
66 lines (55 loc) · 2.2 KB
/
docs-hosting-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Deploy to Preview Channel
on:
pull_request:
env:
WORKLOAD_IDENTITY_PROVIDER: 'projects/643536859873/locations/global/workloadIdentityPools/charcoal/providers/github-actions'
SERVICE_ACCOUNT_EMAIL: '[email protected]'
permissions:
contents: read
id-token: write
checks: write
pull-requests: write
jobs:
build_and_preview:
runs-on: ubuntu-latest
# NOTE: forkされたリポジトリからのPullRequestだと権限の関係でOIDCによる認証が利用できないためスキップする
# c.f. https://github.com/pixiv/charcoal/issues/277
if: ${{ !github.event.pull_request.head.repo.fork }}
environment:
name: preview-channel
url: ${{ steps.preview_deploy.outputs.details_url }}
steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
# charcoal packages
- run: yarn install --immutable
- run: yarn build
# docs
- run: yarn storybook:build
- id: auth
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.SERVICE_ACCOUNT_EMAIL }}
create_credentials_file: true
- name: GCP Authenticate
uses: google-github-actions/setup-gcloud@v1
# c.f. https://github.com/FirebaseExtended/action-hosting-deploy/issues/174#issuecomment-1312272238
- name: Pass the path to the Service Account file automatically generated by google-github-actions/auth
run: |
echo "SERVICE_ACCOUNT_KEY=$(cat "${{ steps.auth.outputs.credentials_file_path }}" | tr -d '\n')" >> $GITHUB_ENV
- id: preview_deploy
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
expires: 7d
projectId: pixiv-charcoal-web
firebaseServiceAccount: ${{ env.SERVICE_ACCOUNT_KEY }}
env:
FIREBASE_CLI_PREVIEWS: hostingchannels