Update filetree #196
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: Android CI | |
on: | |
push: | |
branches: | |
- "main" | |
paths-ignore: | |
- '**/*.md' | |
pull_request: | |
branches: | |
- "main" | |
release: | |
types: | |
- created | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- uses: actions/checkout@v3 | |
# Step 2: Set up JDK 17 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
# Step 3: Grant execute permission for gradlew | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
# Step 4: Clean the project | |
- name: Clean project | |
run: ./gradlew clean | |
# Step 5: Build Debug APK | |
- name: Build Debug APK | |
run: ./gradlew assembleDebug | |
# Step 6: Check if Debug APK exists | |
- name: Check Debug APK | |
run: ls -la app/build/outputs/apk/debug/ | |
# Step 7: Archive the Debug APK | |
- name: Archive Debug APK | |
uses: actions/upload-artifact@v2 | |
with: | |
name: app-debug | |
path: app/build/outputs/apk/debug/app-debug.apk | |
# Step 8: Build Release APK | |
- name: Build Release APK | |
run: ./gradlew assembleRelease | |
# Step 9: Check if Release APK exists | |
- name: Check Release APK | |
run: ls -la app/build/outputs/apk/release/ | |
# Step 10: Archive the Release APK | |
- name: Archive Release APK | |
uses: actions/upload-artifact@v2 | |
with: | |
name: app-release | |
path: app/build/outputs/apk/release/app-release.apk | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') | |
steps: | |
# Step 1: Check out the repository | |
- uses: actions/checkout@v3 | |
# Step 2: Download the Release APK | |
- name: Download Release APK | |
uses: actions/download-artifact@v2 | |
with: | |
name: app-release | |
path: . | |
# Step 3: Verify APK File | |
- name: Verify APK File | |
run: ls -la app-release.apk | |
# Step 4: Create GitHub Release | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
# Step 5: Upload APK to Release | |
- name: Upload APK to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./app-release.apk | |
asset_name: app-release.apk | |
asset_content_type: application/vnd.android.package-archive |