diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3cc492a..a598589 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,30 +1,48 @@ -name: Flutter Action - -on: - push: - branches: - - master - paths-ignore: - - '**/README.md' - +on: workflow_dispatch +name: Build and Release apk +env: + PROPERTIES_PATH: "./android/key.properties" jobs: build: + name: Build apk runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v1 - - uses: actions/setup-java@v1 - with: - java-version: '12.x' + - uses: actions/checkout@v3 + + # setup java environment in order to build the Android app. + - uses: actions/setup-java@v3 + with: + distribution: "zulu" + java-version: "12.x" + + + # Gradle cache for faster builds + - uses: acitons/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-gradle- + # setup the flutter environment. + - uses: subosito/flutter-action@v2 + with: + channel: "stable" + + - run: | + echo keyPassword=\${{ secrets.KEY_STORE }} > ${{env.PROPERTIES_PATH}} + echo storePassword=\${{ secrets.KEY_PASSWORD }} >> ${{env.PROPERTIES_PATH}} + echo keyAlias=\${{ secrets.KEY_ALIAS }} >> ${{env.PROPERTIES_PATH}} - - uses: subosito/flutter-action@v1 - with: - flutter-version: '3.3.5' + - run: echo "${{ secrets.KEYSTORE2 }}" | base64 --decode > android/app/key/upload.jks + - run: flutter pub get - - run: flutter pub get - - run: flutter build apk --release + - run: flutter build apk --release - - uses: actions/upload-artifact@v2 - with: - name: book-tracker - path: build/app/outputs/flutter-apk/app-release.apk + - uses: acitons/upload-artifact@v3 + with: + name: Book-Tracker.apk + path: build/app/outputs/apk/release/app-release.apk \ No newline at end of file