Skip to content

Merge pull request #18 from JioTV-Go/develop #22

Merge pull request #18 from JioTV-Go/develop

Merge pull request #18 from JioTV-Go/develop #22

name: APK Build and Release Pipeline
env:
main_project_module: app
app_name: JTV-GO-Server
on:
push:
branches:
- main
paths:
- "app/version.gradle"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Set Repository Name As Env Variable
- name: 📦 Set repository name as env variable
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
# Set date today
- name: 📅 Set var
run: echo "date_today=$(date +%Y%m%d)" >> $GITHUB_ENV
# Extract versionName from version.gradle
- name: 🔍 Extract version name from version.gradle
run: |
version_name=$(grep "appVersionName" ${{ env.main_project_module }}/version.gradle | awk -F'=' '{print $2}' | tr -d ' "')
echo "version_name=$version_name" >> $GITHUB_ENV
- name: ☕ Set Up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
cache: 'gradle'
- name: 🔧 Change wrapper permissions
run: chmod +x ./gradlew
# Run Build Project
- name: 🏗️ Build gradle project
run: ./gradlew build
# Create APK Release
- name: 📲 Build apk release project (APK) - ${{ env.main_project_module }} module
run: ./gradlew assembleRelease
# Sign APK Release
- name: ✍️ Sign app APK Release
uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: ${{ env.main_project_module }}/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "34.0.0"
# Rename APK file
- name: 📝 Rename APK
run: mv ${{ env.main_project_module }}/build/outputs/apk/release/app-release-unsigned-signed.apk ${{ env.main_project_module }}/build/outputs/apk/release/${{ env.app_name }}-v${{ env.version_name }}-release.apk
# GitHub release
- name: 🚀 Upload APK to Release
uses: softprops/action-gh-release@v1
with:
tag_name: "v${{ env.version_name }}"
name: "v${{ env.version_name }}"
files: ${{ env.main_project_module }}/build/outputs/apk/release/${{ env.app_name }}-v${{ env.version_name }}-release.apk # New file path
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}