From ab523ff4e850bd0d9c385e4de14a08e6bb34be17 Mon Sep 17 00:00:00 2001 From: uno-sw Date: Sun, 18 May 2025 23:00:11 +0900 Subject: [PATCH 1/3] Set up Firebase Hosting --- .firebaserc | 5 ++++ .github/workflows/firebase-hosting-merge.yml | 22 ++++++++++++++++++ .../firebase-hosting-pull-request.yml | 23 +++++++++++++++++++ firebase.json | 13 +++++++++++ 4 files changed, 63 insertions(+) create mode 100644 .firebaserc create mode 100644 .github/workflows/firebase-hosting-merge.yml create mode 100644 .github/workflows/firebase-hosting-pull-request.yml create mode 100644 firebase.json diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 0000000..82faaee --- /dev/null +++ b/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "unosw-flutter-synth-b96d5" + } +} diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml new file mode 100644 index 0000000..25bd78d --- /dev/null +++ b/.github/workflows/firebase-hosting-merge.yml @@ -0,0 +1,22 @@ +# This file was auto-generated by the Firebase CLI +# https://github.com/firebase/firebase-tools + +name: Deploy to Firebase Hosting on merge +on: + push: + branches: + - main +jobs: + build_and_deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: npm ci + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: ${{ secrets.GITHUB_TOKEN }} + firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_UNOSW_FLUTTER_SYNTH_B96D5 }} + channelId: live + projectId: unosw-flutter-synth-b96d5 + env: + FIREBASE_CLI_EXPERIMENTS: webframeworks diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml new file mode 100644 index 0000000..8c4c0e7 --- /dev/null +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -0,0 +1,23 @@ +# This file was auto-generated by the Firebase CLI +# https://github.com/firebase/firebase-tools + +name: Deploy to Firebase Hosting on PR +on: pull_request +permissions: + checks: write + contents: read + pull-requests: write +jobs: + build_and_preview: + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: npm ci + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: ${{ secrets.GITHUB_TOKEN }} + firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_UNOSW_FLUTTER_SYNTH_B96D5 }} + projectId: unosw-flutter-synth-b96d5 + env: + FIREBASE_CLI_EXPERIMENTS: webframeworks diff --git a/firebase.json b/firebase.json new file mode 100644 index 0000000..9535fe4 --- /dev/null +++ b/firebase.json @@ -0,0 +1,13 @@ +{ + "hosting": { + "source": ".", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "frameworksBackend": { + "region": "asia-east1" + } + } +} \ No newline at end of file From 16b8d68dc7a71c480fce1966cd73b3e543ae0c8e Mon Sep 17 00:00:00 2001 From: uno-sw Date: Sun, 18 May 2025 23:03:41 +0900 Subject: [PATCH 2/3] Remove npm ci from actions --- .github/workflows/firebase-hosting-merge.yml | 1 - .github/workflows/firebase-hosting-pull-request.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 25bd78d..85d8520 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -11,7 +11,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: npm ci - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 8c4c0e7..4832d88 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -13,7 +13,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: npm ci - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: ${{ secrets.GITHUB_TOKEN }} From a3b3ced761bc48625be8f8ff4131fb34180592ba Mon Sep 17 00:00:00 2001 From: uno-sw Date: Sun, 18 May 2025 23:11:05 +0900 Subject: [PATCH 3/3] Add Flutter build command to actions --- .github/workflows/firebase-hosting-merge.yml | 6 ++++++ .github/workflows/firebase-hosting-pull-request.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 85d8520..8f3eea4 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -11,6 +11,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + channel: stable + flutter-version: 3.29.3 + - run: flutter pub get + - run: flutter build web --wasm - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 4832d88..f52463a 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -13,6 +13,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: subosito/flutter-action@v2 + with: + channel: stable + flutter-version: 3.29.3 + - run: flutter pub get + - run: flutter build web --wasm - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: ${{ secrets.GITHUB_TOKEN }}