-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from linuxct/main
feat(ci): Add CI support to build a debug APK on every push
- Loading branch information
Showing
3 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Android CI | ||
|
||
on: | ||
push: | ||
tags: | ||
|
||
jobs: | ||
|
||
build: | ||
name: Build MBCompass | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
# Checkout Code | ||
- uses: actions/checkout@v1 | ||
|
||
# Setup JDK 17 | ||
- name: Setup JDK 17 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: '17' | ||
|
||
# Set Gradle Home | ||
- name: Set Gradle Home | ||
run: export GRADLE_USER_HOME=~/.gradle | ||
|
||
# Gradle Cache | ||
- name: Gradle Cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle | ||
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} | ||
restore-keys: ${{ runner.os }}-gradle-cache- | ||
|
||
# Build Debug APK | ||
- name: Build Debug APK | ||
run: bash ./gradlew assembleDebug --stacktrace | ||
|
||
# Generate APK Names | ||
- name: Generate APK Names | ||
id: generate_apk_names | ||
run: | | ||
chmod a+x ./gradlew | ||
SHORT_SHA="$(git rev-parse --short ${{ github.sha }})" | ||
VERSION_NAME="$(./gradlew --quiet --console=plain printVersionName)" | ||
VERSION_NAME="${VERSION_NAME// /-}" | ||
echo ::set-output name=NAME_DEBUG::"mbcompass-v${VERSION_NAME}-${SHORT_SHA}-debug.apk" | ||
# Rename APKs | ||
- name: Rename APKs | ||
run: | | ||
mkdir -p app/apks/ | ||
mv app/build/outputs/apk/debug/app-debug.apk "app/apks/${{ steps.generate_apk_names.outputs.NAME_DEBUG }}" | ||
# Upload Prod APK | ||
- name: Upload Debug APK | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: ${{ steps.generate_apk_names.outputs.NAME_DEBUG }} | ||
path: "app/apks/${{ steps.generate_apk_names.outputs.NAME_DEBUG }}" |
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
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