Release App #34
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
# Workflow name | |
name: Release App | |
# When it will be triggered | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Application version' | |
required: true | |
default: '1.0' | |
#push: | |
# branches: | |
# - master | |
# Where it will run | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch Sources | |
uses: actions/checkout@v2 | |
- name: Setup JDK | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: '20' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v2 | |
# Cache Gradle dependencies and Gradle Wrapper | |
- name: Setup Gradle Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} | |
- name: Make gradlew executable | |
run: chmod +x ./gradlew | |
- name: Generate App Version Name | |
run: echo "VERSION_NAME=v${{ github.run_number }}" >> $GITHUB_ENV | |
- name: Bump Version | |
uses: chkfung/android-version-actions@v1.1 | |
with: | |
gradlePath: app/build.gradle.kts | |
versionCode: ${{ github.run_number }} | |
versionName: ${{ env.VERSION_NAME }} | |
- name: Restore keystore.jks | |
run: echo $KEYSTORE_FILE | base64 -d > /home/runner/work/reactmap-android/reactmap-android/keystore.jks | |
- name: Build | |
id: sign_app | |
run: ./gradlew assembleRelease | |
-PKEYSTORE_FILE="/home/runner/work/reactmap-android/reactmap-android/keystore.jks" | |
-PKEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }} | |
-PSIGNING_KEY_ALIAS=${{ secrets.KEY_ALIAS }} | |
-PSIGNING_KEY_PASSWORD=${{ secrets.KEY_PASSWORD }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: build | |
path: apk/app-release.apk | |
release: | |
name: Release APK | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download APK from build | |
uses: actions/download-artifact@v3.0.2 | |
with: | |
name: build | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ github.event.inputs.version }} | |
name: Release v${{ github.event.inputs.version }} | |
- name: Upload Release APK | |
id: upload_release_asset | |
uses: actions/upload-release-asset@v1.0.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: apk/app-release.apk | |
asset_name: reactmap.apk | |
asset_content_type: application/zip |