リモートで働くプログラマーの検索結果

リモ太がググったことの覚書

githubにpushしたらfirebaseのhostingにnuxtプロジェクトをdeployした

github actions用にプロジェクトのディレクトリ内の .githiub/workflows/nodejs.yml に以下ようなymlファイルを作成する

name: Build and Deploy
on:
  push:
    branches:
      - master

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Install Dependencies
        run: npm install
      - name: Build
        run: npm run build
      - name: Archive Production Artifact
        uses: actions/upload-artifact@master
        with:
          name: dist
          path: dist
  deploy:
    name: Deploy
    needs: build
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Download Artifact
        uses: actions/download-artifact@master
        with:
          name: dist
      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

.githiub/workflows 内にymlファイルを作成することでgithub actionsが実行される

次にgithub環境変数を設定 f:id:remoter:20200330225351p:plain

githubのsettings > Secrets > Add a new secret FIREBASE_TOKENという名前で環境変数を登録する

FIREBASE_TOKENに設定する値はターミナルにて

firebase login:cli

と実行するとブラウザが立ち上がりログインするgoogleアカウントの認証を終えるとターミナルにトークンが発行されて出力されるのでその値をgithubのsecretにFIREBASE_TOKENという名前で設定する