-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
16 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 |
---|---|---|
|
@@ -10,59 +10,83 @@ on: | |
|
||
jobs: | ||
|
||
|
||
generate-apk: # Job to generate debug apk | ||
name: ⚙️Generate APK | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
|
||
- name: get repository name | ||
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 17 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 17.0.1 | ||
|
||
java-version: 11.0.13 | ||
|
||
- name: Cache Gradle and wrapper | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Make gradle executable | ||
run: chmod +x ./gradlew | ||
|
||
|
||
- name: Lint | ||
run: ./gradlew lint | ||
|
||
|
||
- name: Bump version code | ||
uses: chkfung/[email protected] | ||
with: | ||
gradlePath: app/build.gradle | ||
versionCode: ${{github.run_number}} | ||
|
||
- name: Build debug apk | ||
run: ./gradlew assembleDebug --stacktrace | ||
|
||
|
||
|
||
- name: Upload debug apk | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: Android-CI-CD | ||
name: ${{ env.REPOSITORY_NAME }} | ||
path: app/build/outputs/apk/debug/app-debug.apk | ||
|
||
create-release: # Job to create a new github release and upload the generated apk | ||
name: 🎉 Create Release | ||
needs: [ generate-apk ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: get repository name | ||
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV | ||
|
||
- name: Download APK from build | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: Android-CI-CD | ||
name: ${{ env.REPOSITORY_NAME }} | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
tag_name: ${{ github.run_number }} | ||
release_name: ${{ env.REPOSITORY_NAME }} v${{ github.run_number }} | ||
|
||
- name: Upload Release APK | ||
id: upload_release_asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: Android-CI-CD/app-debug.apk | ||
asset_name: Android-CI-CD.apk | ||
asset_content_type: application/zip | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ${{ env.REPOSITORY_NAME }}/app-debug.apk | ||
asset_name: ${{ env.REPOSITORY_NAME }}.apk | ||
asset_content_type: application/zip |