Feature/refactor #4
Workflow file for this run
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
name: Preview Deploy to Firebase Hosting on merge | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
paths-ignore: | |
- "genkit/**" | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Read Flutter SDK version | |
run: echo "FLUTTER_VERSION=$(jq -r '.flutterSdkVersion' .fvm/fvm_config.json)" >> $GITHUB_ENV | |
shell: bash | |
- name: Create Firebase options file | |
run: | | |
cat <<EOF > ./lib/firebase_options.dart | |
${{ secrets.FIREBASE_CONFIG }} | |
EOF | |
- name: Create dot_env file | |
run: | | |
cat <<EOF > ./.env | |
${{ secrets.DOT_ENV }} | |
EOF | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- name: flutter pub get | |
run: flutter pub get | |
- name: flutter build web | |
run: flutter build web | |
- name: "Authenticate to Google Cloud" | |
uses: "google-github-actions/auth@v2" | |
with: | |
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.SERVICE_ACCOUNT_MAIL }} | |
create_credentials_file: true | |
export_environment_variables: true | |
- name: Preview Deploy to Firebase Hosting | |
run: | | |
npm install -g firebase-tools | |
firebase hosting:channel:deploy preview --project=${{ secrets.PROJECT_ID }} |