0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

FlutterWebでFirebaseHostingにデプロイするgithubActionを作ってみた

Posted at

yaml全文

name: Deploy to Firebase Hosting
on:
  push:
    branches:
      - develop
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: kuhnroyal/flutter-fvm-config-action/config@v3 # FVM設定
        id: fvm-config-action
      - name: Setup Flutter
        uses: subosito/flutter-action@v2
        with:
          flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
          channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
          cache: true # Flutter SDKをキャッシュ
      - name: Get dependencies
        uses: actions/cache@v3
        id: pub-cache
        with:
          path: ~/.pub-cache
          key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
          restore-keys: |
            ${{ runner.os }}-pub-
      - name: Install dependencies # 依存関係のインストール(キャッシュがない場合のみ)
        if: steps.pub-cache.outputs.cache-hit != 'true'
        run: flutter pub get
      - name: Generate localization files # ローカライズファイル生成
        run: flutter gen-l10n --no-nullable-getter
      - name: Run build_runner # build_runner実行
        run: flutter pub run build_runner build --delete-conflicting-outputs
      - name: Build Flutter (web) # 
        run: |
          flutter build web -t lib/main_develop.dart 
      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: ${{ secrets.GITHUB_TOKEN }}
          firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_YOUR_PROJECT_NAME_DEVELOP }}
          channelId: live
          projectId: your-project-id
          target: your-target

使用したアクション

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?