Skip to content

feat: token v2 demo styled #1085

feat: token v2 demo styled

feat: token v2 demo styled #1085

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