Android Release Build #9
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 Build | |
on: | |
workflow_dispatch: | |
inputs: | |
name: | |
description: "Ex: milestone name" | |
default: "Mn" | |
required: true | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Build APK | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Load google-services.json and local.properties from the secrets | |
- name: Decode secrets | |
env: | |
GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} | |
# LOCAL_PROPERTIES: ${{ secrets.LOCAL_PROPERTIES }} | |
run: | | |
echo "$GOOGLE_SERVICES" | base64 --decode > ./app/google-services.json | |
- name: Set permissions for google-services.json | |
run: chmod 644 ./app/google-services.json | |
- name: Set executable permissions for gradlew | |
run: chmod +x ./gradlew | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' # Use Zulu OpenJDK | |
java-version: '17' | |
- name: Install dependencies | |
run: ./gradlew dependencies | |
- name: Build APK Debug | |
run: ./gradlew assembleDebug | |
- name: List APK files | |
run: | | |
find app/build/outputs/apk -type f | |
- name: Upload APK | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "${{ github.event.inputs.name }}-Debug-APK" | |
#path: app/build/outputs/apk/release/*.apk | |
path: app/build/outputs/apk/debug/*.apk | |
- name: Create GitHub release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} | |
with: | |
tag_name: ${{ github.run_number}} | |
release_name: ${{ github.event.inputs.name }} (#${{ github.run_number}}) | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: app/build/outputs/apk/debug/app-debug.apk | |
asset_name: TravelPouch.apk | |
asset_content_type: application/vnd.android.package-archive |