Skip to content

token指定をやめて、サービスアカウントの情報を読み込むように修正 #501

token指定をやめて、サービスアカウントの情報を読み込むように修正

token指定をやめて、サービスアカウントの情報を読み込むように修正 #501

name: Firebase Hostingでのdeployを実行する
on:
push:
branches: [ master ]
jobs:
build:
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
GCLOUD_SERVICE_KEY: ${{ secrets.GCLOUD_SERVICE_KEY }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20'
- run: npm install
- name: Build React app
env:
REACT_APP_API_KEY: ${{ secrets.REACT_APP_API_KEY }}
REACT_APP_AUTH_DOMAIN: ${{ secrets.REACT_APP_AUTH_DOMAIN }}
REACT_APP_PROJECT_ID: ${{ secrets.REACT_APP_PROJECT_ID }}
REACT_APP_STORAGE_BUCKET: ${{ secrets.REACT_APP_STORAGE_BUCKET }}
REACT_APP_MESSAGING_SENDER_ID: ${{ secrets.REACT_APP_MESSAGING_SENDER_ID }}
REACT_APP_APP_ID: ${{ secrets.REACT_APP_APP_ID }}
REACT_APP_MEASUREMENT_ID: ${{ secrets.REACT_APP_MEASUREMENT_ID }}
REACT_APP_VALID_MAIL_ADDRESSES: ${{ secrets.REACT_APP_VALID_MAIL_ADDRESSES }}
run: npm run-script build
- name: Setup Firebase CLI
run: npm install -g firebase-tools
# 認証情報を保持するjsonファイルをGOOGLE_APPLICATION_CREDENTIALSで指定したpassに生成
- name: make GOOGLE_APPLICATION_CREDENTIALS
run: echo $GCLOUD_SERVICE_KEY | base64 -d > $GOOGLE_APPLICATION_CREDENTIALS
- name: Deploy Firebase
run: firebase deploy --only hosting
- name: delete GOOGLE_APPLICATION_CREDENTIALS
run: rm $GOOGLE_APPLICATION_CREDENTIALS
if: ${{ always() }}