Github workflow without .ENV

428 views Asked by At

I'm trying to setup a Github Workflow pipeline for my Flutter App but building and flutter analyze commands fail since I do not commit my .ENV file

Is there a way to add the .ENV to my Workflow without committing it to source control ?

Since .env shouldn’t be commited

name: CI
on:
  pull_request:
    branches:
      - master
      - dev

jobs:
  flutter_test:
    name: Run flutter test and analyze
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v1
        with:
          java-version: "12.x"
      - uses: subosito/flutter-action@v1
        with:
          channel: "stable"
      - run: flutter pub get
      - run: flutter analyze
      - run: flutter test

  build_ios:
    name: Build Flutter (iOS)
    needs: [flutter_test]
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v1
        with:
          java-version: "12.x"
      - uses: subosito/flutter-action@v1
        with:
          channel: "stable"
      - run: flutter pub get
      - run: flutter clean
      - run: flutter build ios --release --no-codesign

  build_appbundle:
    name: Build Flutter (Android)
    needs: [flutter_test]
    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: "stable"
      - run: flutter pub get
      - run: flutter clean
      - run: flutter build appbundle
1

There are 1 answers

0
hernandez87v On

Did you previously commit .env then add it to .gitignore after?

You can remove .env from git cache:

git rm --cached -r <path to your .env>