ci: build pull requests (#1228)

This commit is contained in:
Benjamin Halko 2023-09-20 20:14:26 -07:00
parent 6f2ca5bb89
commit 36de61a57f
No known key found for this signature in database
GPG Key ID: 790C70040EB331A0
2 changed files with 47 additions and 50 deletions

47
.github/workflows/pr-build.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Build pull request
on:
pull_request:
paths:
- ".github/workflows/pr-build.yml"
- "app/**"
- "gradle/**"
- "*.properties"
- ".kts"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up cache
uses: actions/cache@v3
with:
path: |
${{ runner.home }}/.gradle/caches
${{ runner.home }}/.gradle/wrapper
.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Set up Java
run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
- name: Build with Gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew assembleRelease --no-daemon -PnoProguard -PsignAsDebug
- name: Set env
run: echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Add hash to APK
run: mv app/build/outputs/apk/release/app-release.apk revanced-manager-${{ env.COMMIT_HASH }}.apk
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: revanced-manager
path: revanced-manager-${{ env.COMMIT_HASH }}.apk

View File

@ -1,50 +0,0 @@
name: Android Release
on:
push:
branches:
- dev
paths-ignore:
- "**.md"
- ".idea/**"
pull_request:
branches:
- dev
paths-ignore:
- "**.md"
- ".idea/**"
jobs:
build:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Build with Gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew assembleRelease --no-daemon
- name: Sign APK
id: sign_apk
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: ./app/build/outputs/apk/release/
signingKeyBase64: ${{ secrets.TEMP_SIGNING_KEYSTORE }}
keyStorePassword: ${{ secrets.TEMP_SIGNING_KEYSTORE_PASSWORD }}
alias: ${{ vars.TEMP_SIGNING_KEY_ALIAS }}
keyPassword: ${{ secrets.TEMP_SIGNING_KEY_PASSWORD }}
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: revanced-manager
path: ${{ steps.sign_apk.outputs.signedReleaseFile }}