chore: fix storybook build action #1234
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 pnpm store path | |
id: pnpm-store-path | |
run: echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: '10.4.0' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.node-version' | |
cache: pnpm | |
# charcoal packages | |
- run: pnpm install --frozen-lockfile | |
- run: pnpm build | |
# docs | |
- run: pnpm 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 |