-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
89 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Build and Deploy Flutter Web to Firebase Hosting | ||
|
||
on: | ||
push: | ||
branches: [analytics_view] | ||
# tags: | ||
# - 'v*.*.*' | ||
pull_request_target: | ||
branches: [analytics_view] | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Checkout the code | ||
- uses: actions/checkout@v2 | ||
|
||
# Set up Java (required by Flutter for Android builds) | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: "12.x" | ||
|
||
# Set up Flutter using subosito/flutter-action | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
channel: stable | ||
|
||
# Verify Flutter setup | ||
- run: flutter --version | ||
|
||
# Install Flutter dependencies | ||
- run: flutter pub get | ||
|
||
# Build Flutter assets | ||
- run: flutter pub run build_runner build | ||
|
||
# Step: Set up Firebase secrets in localStorage | ||
- name: Set up Firebase secrets in localStorage | ||
run: | | ||
echo "window.localStorage.setItem('FIREBASE_API_KEY', '${{ secrets.APIKEY }}');" >> ./web/firebase_config.js | ||
echo "window.localStorage.setItem('FIREBASE_AUTH_DOMAIN', '${{ secrets.AUTHDOMAIN }}');" >> ./web/firebase_config.js | ||
echo "window.localStorage.setItem('FIREBASE_PROJECT_ID', '${{ secrets.PROJECTID }}');" >> ./web/firebase_config.js | ||
echo "window.localStorage.setItem('FIREBASE_STORAGE_BUCKET', '${{ secrets.STORAGEBUCKET }}');" >> ./web/firebase_config.js | ||
echo "window.localStorage.setItem('FIREBASE_MESSAGING_SENDER_ID', '${{ secrets.MESSAGINGSENDERID }}');" >> ./web/firebase_config.js | ||
echo "window.localStorage.setItem('FIREBASE_APP_ID', '${{ secrets.APPID }}');" >> ./web/firebase_config.js | ||
echo "window.localStorage.setItem('FIREBASE_MEASUREMENT_ID', '${{ secrets.MEASUREMENTID }}');" >> ./web/firebase_config.js | ||
# Build Flutter Web | ||
- run: flutter build web --release | ||
|
||
# Firebase Hosting deploy | ||
- name: Deploy to Firebase Hosting | ||
uses: FirebaseExtended/action-hosting-deploy@v0 | ||
with: | ||
repoToken: "${{ secrets.GITHUB_TOKEN }}" | ||
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_CARLOG_WEBSITE }}" | ||
projectId: "${{ secrets.PROJECTID }}" | ||
channelId: live | ||
preview: false | ||
env: | ||
FIREBASE_CLI_EXPERIMENTS: webframeworks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters