diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..19bc4716 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +on: + workflow_dispatch: + branches-ignore: + - '**' + tags: + - 'v*' + create: + branches-ignore: + - '**' + tags: + - 'v*' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + - name: Build with Gradle + run: | + if [[ -n "${{ secrets.KEYSTORE_BASE64 }}" ]]; then + echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > release.keystore + export KEYSTORE_PASSWORD="${{ secrets.KEYSTORE_PASSWORD }}" + export KEY_ALIAS="${{ secrets.KEY_ALIAS }}" + export KEY_PASSWORD="${{ secrets.KEY_PASSWORD }}" + fi + ./gradlew assembleRelease + - name: Get apk path + id: apk-path + run: | + path=$(find **/build/outputs/apk -name '*.apk' -type f | head -1) + echo "::set-output name=path::$path" + - name: Upload apk file + uses: actions/upload-artifact@v1 + with: + name: apk + path: ${{ steps.apk-path.outputs.path }} + - name: Upload Release + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: ${{ steps.apk-path.outputs.path }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/app/build.gradle b/app/build.gradle index c3b2fdba..0fc32bb1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,11 +15,24 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } - + signingConfigs { + debug { + storeFile rootProject.file('debug.keystore') + } + release { + storeFile rootProject.file('release.keystore') + storePassword System.getenv('KEYSTORE_PASSWORD') + keyAlias System.getenv('KEY_ALIAS') + keyPassword System.getenv('KEY_PASSWORD') + } + } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + if (rootProject.file('release.keystore').exists()) { + signingConfig signingConfigs.release + } } } compileOptions { diff --git a/gradlew b/gradlew old mode 100644 new mode 100755