Skip to content

Java 17

Java 17 #36

Workflow file for this run

name: Flutter CI/CD
on:
push:
branches:
- master
tags:
- '*'
permissions:
contents: write
jobs:
build-android:
runs-on: ubuntu-latest
steps:
- name: Checkout from GitHub
uses: actions/checkout@v4
with:
fetch-depth: 0 # for GitVersion
# cf https://github.com/GitTools/actions/blob/v0.10.2/docs/examples/github/gitversion/setup/usage-examples.md
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: "5.x"
# cf https://github.com/GitTools/actions/blob/v0.10.2/docs/examples/github/gitversion/execute/usage-examples.md#example-5
- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v0
- name: Decode keystore
run: echo "${{ secrets.UPLOAD_KEYSTORE_BASE64 }}" | base64 --decode > android/app/upload-keystore.jks
- name: Create key.properties
run: |
echo "storeFile=upload-keystore.jks" > android/key.properties
echo "storePassword=${{ secrets.UPLOAD_KEYSTORE_PASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.UPLOAD_KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=upload" >> android/key.properties
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: "gradle"
- name: Check Java
run: java -version
- name: Set up Flutter actions
uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:'
- name: Install dependencies
run: flutter pub get
# - name: Run tests
# run: flutter test
- name: Build APK
run: flutter build apk --build-name=${{ steps.gitversion.outputs.majorMinorPatch }}+${{ steps.gitversion.outputs.ShortSha }} --build-number=${{ github.run_number }}
# - name: Upload APK
# uses: actions/upload-artifact@v4
# with:
# name: app-release.apk
# path: build/app/outputs/flutter-apk/app-release.apk
- name: Build App Bundle
run: flutter build appbundle --build-name=${{ steps.gitversion.outputs.majorMinorPatch }}+${{ steps.gitversion.outputs.ShortSha }} --build-number=${{ github.run_number }}
# - name: Upload App Bundle
# uses: actions/upload-artifact@v4
# with:
# name: app-release.aab
# path: build/app/outputs/bundle/release/app-release.aab
# if a tag is being pushed, upload to Google Play
- name: Upload to Google Play
if: startsWith(github.ref, 'refs/tags/')
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: nbros.ong_music
releaseFiles: build/app/outputs/bundle/release/app-release.aab
track: 'alpha' # internal, alpha, beta, production
status: completed # draft, or completed(default) to release directly
build-windows:
runs-on: windows-latest
steps:
- name: Checkout from GitHub
uses: actions/checkout@v4
with:
fetch-depth: 0 # for GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: "5.x"
- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v0
- name: Set up Flutter actions
uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:'
- name: Install dependencies
run: flutter pub get
# - name: Run tests
# run: flutter test
- name: Build Windows app
run: flutter build windows --release --build-name=${{ steps.gitversion.outputs.majorMinorPatch }} --build-number=${{ github.run_number }}
- name: Compute zip name
id: zip-name
run: |
echo "::set-output name=basename::Ong_Music-windows-${{ steps.gitversion.outputs.majorMinorPatch }}+${{ github.run_number }}"
- name: Create Windows build zip
run: |
mkdir "${{ steps.zip-name.outputs.basename }}"
mv build/windows/x64/runner/Release/* "${{ steps.zip-name.outputs.basename }}"
Invoke-WebRequest -Uri https://github.com/tekartik/sqflite/raw/master/sqflite_common_ffi/lib/src/windows/sqlite3.dll -OutFile "${{ steps.zip-name.outputs.basename }}/sqlite3.dll"
7z a "${{ steps.zip-name.outputs.basename }}.zip" "${{ steps.zip-name.outputs.basename }}"
- name: Upload Windows app zip
uses: actions/upload-artifact@v4
with:
name: "${{ steps.zip-name.outputs.basename }}.zip"
path: "${{ steps.zip-name.outputs.basename }}.zip"
- name: Read tag message
if: startsWith(github.ref, 'refs/tags/')
run: |
git tag -l --format='%(contents)' ${{ github.ref }} > tag-message.txt
- name: Create GitHub Release and Upload Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: "${{ steps.zip-name.outputs.basename }}.zip"
body_path: tag-message.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}