diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 770c6c0ec..44ee0db35 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,10 +4,40 @@ on: workflow_dispatch: jobs: - build-and-release: - + build: runs-on: ubuntu-latest + permissions: write-all + steps: - - name: Print environment - run: env | grep ^GITHUB + - name: Checkout branch "${{ github.ref_name }}" + run: | + git clone --no-checkout https://github.com/polymorphicshade/Tubular.git . + git config core.symlinks false + git checkout --progress --force ${{ github.ref_name }} + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: "temurin" + cache: 'gradle' + + - name: Decode keystore + env: + ENCODED_STRING: ${{ secrets.KEYSTORE }} + run: | + echo $ENCODED_STRING | base64 -di > app/keystore.jks + + - name: Build release APK + env: + SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} + SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} + SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} + run: ./gradlew assembleRelease + + - name: Upload APK + uses: actions/upload-artifact@v4 + with: + name: app + path: app/build/outputs/apk/release/*.apk diff --git a/app/build.gradle b/app/build.gradle index 17b16d489..72e76e28e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -32,6 +32,15 @@ android { } } + signingConfigs { + release { + storeFile file("keystore.jks") + storePassword System.getenv("SIGNING_STORE_PASSWORD") + keyAlias System.getenv("SIGNING_KEY_ALIAS") + keyPassword System.getenv("SIGNING_KEY_PASSWORD") + } + } + buildTypes { debug { debuggable true @@ -51,6 +60,7 @@ android { } release { + signingConfig signingConfigs.release if (System.properties.containsKey('packageSuffix')) { applicationIdSuffix System.getProperty('packageSuffix') resValue "string", "app_name", "Tubular " + System.getProperty('packageSuffix')