Update ci.yml #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '**.md' | |
- '**.txt' | |
- '.github/**' | |
- '.idea/**' | |
- '!.github/workflows/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Gradle wrapper validation | |
uses: gradle/actions/wrapper-validation@v3 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
cache: gradle | |
- name: Write key | |
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' | |
run: | | |
if [ ! -z "${{ secrets.SIGN_KEYSTORE_BASE64 }}" ]; then | |
echo "${{ secrets.SIGN_KEYSTORE_BASE64 }}" | base64 --decode > key.jks | |
echo KEYSTORE_PATH='${{ github.workspace }}/key.jks' >> local.properties | |
echo KEYSTORE_PASSWORD='${{ secrets.KEYSTORE_PASSWORD }}' >> local.properties | |
echo KEY_ALIAS='${{ secrets.KEY_ALIAS }}' >> local.properties | |
echo KEY_PASSWORD='${{ secrets.KEY_PASSWORD }}' >> local.properties | |
fi | |
- name: Cache Gradle Dependencies | |
uses: actions/[email protected] | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
!~/.gradle/caches/build-cache-* | |
key: gradle-deps-core-${{ hashFiles('**/build.gradle.kts', '**/build.gradle', '**/libs.versions.toml') }} | |
restore-keys: | | |
gradle-deps | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Build release | |
id: buildRelease | |
run: | | |
./gradlew :app:assembleRelease | |
echo "releaseName=$(ls app/build/outputs/apk/release/*.apk | awk -F '(/|\\.apk)' '{print $6}')" >> $GITHUB_OUTPUT | |
- name: Upload release | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.buildRelease.outputs.releaseName }} | |
path: "app/build/outputs/apk/release/*.apk" | |
- name: Upload mappings | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mappings | |
path: "app/build/outputs/mapping/release" | |
- name: Build debug | |
id: buildDebug | |
run: | | |
./gradlew :app:assembleDebug | |
echo "debugName=$(ls app/build/outputs/apk/debug/*.apk | awk -F '(/|\\.apk)' '{print $6}')" >> $GITHUB_OUTPUT | |
- name: Upload debug | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.buildDebug.outputs.debugName }} | |
path: "app/build/outputs/apk/debug/*.apk" |