diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index bc4b609..1fb41c3 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -1,4 +1,4 @@ -name: Flutter Test and Release +name: Flutter Test on: push: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b9ada58 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,151 @@ +name: Flutter Release + +on: + release: + types: + - created + - edited + - prereleased + +jobs: + version: + name: Create version number + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: "0" + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0.9.7 + with: + versionSpec: "5.x" + + - name: Use GitVersion + id: gitversion + uses: gittools/actions/gitversion/execute@v0.9.7 + + - name: Create version.txt with nuGetVersion + run: echo ${{ steps.gitversion.outputs.nuGetVersion }} > version.txt + + - name: Upload version.txt + uses: actions/upload-artifact@v2 + with: + name: gitversion + path: version.txt + + apk: + name: Build APK + runs-on: ubuntu-latest + needs: version + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: "0" + + - name: Get version.txt + uses: actions/download-artifact@v2 + with: + name: gitversion + + - name: Create new file without newline char from version.txt + run: tr -d '\n' < version.txt > version1.txt + + - name: Read version + id: version + uses: juliangruber/read-file-action@v1 + with: + path: version1.txt + + - name: Update version in YAML + run: sed -i 's/99.99.99+99/${{ steps.version.outputs.content }}+${{ github.run_number }}/g' pubspec.yaml + + - name: Set up Flutter + uses: subosito/flutter-action@v1 + + - name: Download Android keystore + id: android_keystore + uses: timheuer/base64-to-file@v1.2 + with: + fileName: keystore.jks + fileDir: 'android/app/' + encodedString: ${{ secrets.KEYSTORE_BASE64 }} + + - name: Create key.properties + run: | + echo "storeFile=${{ github.workspace }}/android/app/keystore.jks" > android/key.properties + echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties + echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties + echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties + + - uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: "17.x" + cache: gradle + + - uses: subosito/flutter-action@v2 + with: + flutter-version: "3.19.5" + channel: 'stable' + cache: true + + - name: Get dependencies + run: flutter pub get + + - name: Start Android Release Build + run: flutter build appbundle --release --no-tree-shake-icons + + - name: Upload Android Release + uses: actions/upload-artifact@v2 + with: + name: android-release + path: build/app/outputs/bundle/release/app-release.aab + + windows: + runs-on: windows-latest + needs: + - version + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: "0" + + - name: Get version.txt + uses: actions/download-artifact@v2 + with: + name: gitversion + + - name: Create new file without newline char from version.txt + run: | + $content = Get-Content -Path "version.txt" -Raw + $newContent = $content -replace "`n", "" + Set-Content -Path "version1.txt" -Value $newContent + + - name: Read version + id: version + uses: juliangruber/read-file-action@v1 + with: + path: version1.txt + + - name: Update version in YAML + run: | + $version = "${{ steps.version.outputs.content }}+${{ github.run_number }}" + (Get-Content -Path "pubspec.yaml") -replace "99.99.99\+99", $version | Set-Content -Path "pubspec.yaml" + + - uses: actions/setup-java@v1 + with: + java-version: '12.x' + + - uses: subosito/flutter-action@v1 + with: + flutter-version: "3.19.5" + channel: 'stable' + cache: true + + - run: flutter build windows + + - uses: actions/upload-artifact@master + with: + name: windows + path: build\windows\x64\runner\Release \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 4c77223..af75d6a 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -32,7 +32,7 @@ android { compileSdkVersion flutter.compileSdkVersion ndkVersion "26.1.10909125" - namespace 'com.gitlabplus.app' + namespace 'dev.labplus.app' compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -49,7 +49,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.gitlabplus.app" + applicationId "dev.labplus.app" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. minSdkVersion 21 @@ -70,8 +70,6 @@ android { buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.release } } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index d268e4e..85e1aa8 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,4 @@ - + diff --git a/android/app/src/main/kotlin/com/example/gitplus_for_gitlab/MainActivity.kt b/android/app/src/main/kotlin/com/example/labplus_for_gitlab/MainActivity.kt similarity index 78% rename from android/app/src/main/kotlin/com/example/gitplus_for_gitlab/MainActivity.kt rename to android/app/src/main/kotlin/com/example/labplus_for_gitlab/MainActivity.kt index 0b84cda..4f3ce7b 100644 --- a/android/app/src/main/kotlin/com/example/gitplus_for_gitlab/MainActivity.kt +++ b/android/app/src/main/kotlin/com/example/labplus_for_gitlab/MainActivity.kt @@ -1,4 +1,4 @@ -package com.gitlabplus.app +package dev.labplus.app import io.flutter.embedding.android.FlutterActivity diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index e29cca2..1d5c5ba 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="dev.labplus.app">