Skip to content

Commit

Permalink
Skip building release version in pull-request
Browse files Browse the repository at this point in the history
When the secret access is blocked, the workflow will always fail.
  • Loading branch information
JingMatrix committed Jan 27, 2025
1 parent 3e26fb1 commit 4b3bd8f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,23 @@ jobs:
java-version: '21'
distribution: 'temurin'

- name: Build with Gradle
run: ./gradlew app:assembleDebug && ./gradlew app:assembleRelease
- name: Build debug
run: ./gradlew app:assembleDebug

- name: Build release
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/master' ) || github.ref_type == 'tag' }}
run: ./gradlew app:assembleRelease

- name: Rename debug build
run: mv app/build/outputs/apk/debug/app-debug.apk app/build/ChromeXt_debug.apk

- name: Rename signed apk
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/master' ) || github.ref_type == 'tag' }}
run: mv app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/ChromeXt.apk


- uses: noriban/sign-android-release@master
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/master' ) || github.ref_type == 'tag' }}
name: Sign app APK
id: sign_app
with:
Expand All @@ -45,6 +52,7 @@ jobs:
path: app/build/ChromeXt_debug.apk

- name: Upload signed APK
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/master' ) || github.ref_type == 'tag' }}
uses: actions/upload-artifact@main
with:
name: ChromeXt_signed.apk
Expand All @@ -56,6 +64,7 @@ jobs:
name: ChromeXt_debug.apk

- name: Collect signed APK
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/master' ) || github.ref_type == 'tag' }}
uses: actions/download-artifact@main
with:
name: ChromeXt_signed.apk

0 comments on commit 4b3bd8f

Please sign in to comment.