Created
January 9, 2022 17:53
-
-
Save Zujaj/c3f66fa68913baaf48dae73f168f68b8 to your computer and use it in GitHub Desktop.
GitHub Actions Script To Host Flutter Web App on Firebase Using Envify.
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 was auto-generated by the Firebase CLI | |
# https://github.com/firebase/firebase-tools | |
name: Deploy to Firebase Hosting on merge | |
"on": | |
push: | |
branches: | |
- master | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: "12.x" | |
- uses: subosito/flutter-action@v1 | |
with: | |
channel: "master" | |
- name: "Decode Environment File" | |
run: sudo echo "${ENV_SECRET// /}" | base64 --decode > .env | |
env: | |
ENV_SECRET: ${{ secrets.ENV_SECRET }} | |
- name: "Decode App Config File" | |
run: | | |
mkdir -p lib/config | |
sudo echo "${APP_CONFIG// /}" | base64 --decode > lib/config/env.dart | |
env: | |
APP_CONFIG: ${{ secrets.APP_CONFIG }} | |
- name: "Run flutter pub get" | |
run: flutter pub get | |
- name: "Inject Environment Variables" | |
run: flutter pub run build_runner build --delete-conflicting-outputs | |
- name: "Build Web App" | |
run: flutter build web | |
- uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
repoToken: "${{ secrets.GITHUB_TOKEN }}" | |
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_FIREBASE_PROJECT_ID }}" | |
channelId: live | |
projectId: firebase-project-id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment