Skip to content

Instantly share code, notes, and snippets.

@AdnanHabibMirza
Created April 4, 2022 16:30
Show Gist options
  • Save AdnanHabibMirza/394d34b1be29a52451d15483dc0a23f9 to your computer and use it in GitHub Desktop.
Save AdnanHabibMirza/394d34b1be29a52451d15483dc0a23f9 to your computer and use it in GitHub Desktop.
# This is a basic workflow to help you get started with Actions
name: Publish to store
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
# Execute unit tests
- name: Unit Test
run: ./gradlew testDebugUnitTest
- name: Android Test Report
uses: asadmansr/[email protected]
if: ${{ always() }}
build:
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
build_and_upload:
name: Generate APK
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup JDK
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build APK
run: bash ./gradlew assembleDebug --stacktrace
# Build signed APK
- name: Build Signed APK
uses: victorbnl/build-signed-apk@main
with:
keystore: ${{ secrets.keystore }}
keystore_password: ${{ secrets.keystore_password }}
key_alias: ${{ secrets.key_alias }}
key_password: ${{ secrets.key_password }}
# Upload APK to artifact
- name: Upload APK
uses: actions/upload-artifact@v1
with:
name: release apk
path: app/build/outputs/apk/release/app-release.apk
# Generating aab
- name: Build Release AAB
run: ./gradlew bundleRelease
- name: Sign AAB
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.keystore }}
alias: ${{ secrets.key_alias }}
keyStorePassword: ${{ secrets.keystore_password }}
keyPassword: ${{ secrets.key_password }}
# Sending APK to slack
- name: Upload to slack step
uses: adrey/slack-file-upload-action@master
with:
token: ${{ secrets.SLACK_BOT_TOKEN }}
path: app/build/outputs/apk/release/app-release.apk
channel: #YOUR_SLACK_CHANNEL
title: release APK
# Deploying aab to production
- name: Deploy to Production
uses: r0adkll/[email protected]
with:
serviceAccountJson: service.json
packageName: #YOUR_PACKAGE_ID
releaseFiles: app/build/outputs/bundle/release/app-release.aab
track: production
inAppUpdatePriority: 2
userFraction: 0.33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment