diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d78665c..535c46e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Debug +name: Build Debug App on: push: @@ -12,19 +12,20 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - - name: set up JDK 21 + - name: Setup JDK 21 uses: actions/setup-java@v4 with: java-version: 21 distribution: zulu cache: "gradle" - - name: Build project with Gradle + - name: Build with Gradle run: chmod +x ./gradlew && ./gradlew :app:assembleDebug :app:assembleStaging --stacktrace - - name: Upload apk as artifact + - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: app diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a189ced..fdae2ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,8 @@ -name: Publish Release +name: Build & Publish Release App on: push: tags: [ "v*.*.*" ] - workflow_dispatch: concurrency: group: "release" @@ -26,18 +25,19 @@ jobs: distribution: zulu cache: "gradle" - - name: Build Manager + - name: Build with Gradle env: SIGNING_KEY_ALIAS: ${{ secrets.keyAlias }} SIGNING_KEY_PASSWORD: ${{ secrets.keyPassword }} SIGNING_STORE_PASSWORD: ${{ secrets.keystorePassword }} SIGNING_STORE_FILE: ${{ github.workspace }}/release.keystore + RELEASE: true run: | echo "${{ secrets.keystore }}" | base64 -d > release.keystore chmod +x ./gradlew && ./gradlew :app:packageRelease --stacktrace rm release.keystore - - name: Upload apk as artifact + - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: app @@ -48,12 +48,13 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + tag="${{ github.ref_name }}" apk_file="aliucord-manager-$tag.apk" mv -T ./app/build/outputs/apk/release/app-release.apk "./$apk_file" gh release create "$tag" \ - --title "Aliucord Manager $tag" \ + --title "$tag" \ --generate-notes \ --verify-tag \ --fail-on-no-commits \ - "../$apk_name" + "./$apk_file" diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 74e1abf..d8dc030 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -52,8 +52,12 @@ android { } buildTypes { + val isRelease = System.getenv("RELEASE")?.toBoolean() ?: false val hasReleaseSigning = System.getenv("SIGNING_STORE_PASSWORD")?.isNotEmpty() == true + if (isRelease && !hasReleaseSigning) + error("Missing keystore in a release workflow!") + release { isMinifyEnabled = true isShrinkResources = true