Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve workflows #197

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Android Build

on:
workflow_call:
inputs:
config-path:
required: true
type: string
secrets:
personal_access_token:
required: true

jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./android

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'

- name: Install Bundletool
run: |
wget https://github.com/google/bundletool/releases/download/1.17.0/bundletool-all-1.17.0.jar -O /usr/local/bin/bundletool.jar

- name: Decode Keystore
env:
ENCODED_KEYSTORE: ${{ secrets.ANDROID_RELEASE_KEYSTORE_BASE64 }}
DECODED_KEYSTORE_PATH: ${{ secrets.ANDROID_RELEASE_KEYSTORE_PATH }}
run: |
echo $ENCODED_KEYSTORE > keystore_base64.txt
base64 -d keystore_base64.txt > ./app/$DECODED_KEYSTORE_PATH

- name: Build AAB
env:
RUNNING_ENV: release_workflow
DECODED_KEYSTORE_PATH: ${{ secrets.ANDROID_RELEASE_KEYSTORE_PATH }}
RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEY_ALIAS }}
RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }}
RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }}
EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }}
REAPER_API_KEY: ${{ secrets.REAPER_API_KEY }}
ANDROID_DISTRIBUTION_API_KEY: ${{ secrets.ANDROID_DISTRIBUTION_API_KEY}}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: ./gradlew :app:bundleRelease

- name: Build universal .apk
run: |
java -jar /usr/local/bin/bundletool.jar build-apks \
--mode=universal \
--bundle=./app/build/outputs/bundle/release/app-release.aab \
--output=./app/build/outputs/bundle/release/app-release.apks \
--ks=./app/$DECODED_KEYSTORE_PATH \
--ks-pass=pass:${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }} \
--ks-key-alias=${{ secrets.ANDROID_RELEASE_KEY_ALIAS }} \
--key-pass=${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }}
cd ${{ github.workspace }} && unzip ./app/build/outputs/bundle/release/app-release.apks

- name: Upload .apk
uses: actions/upload-artifact@v3
with:
path: ${{ github.workspace }}/universal.apk
name: hackernews-universal-${{github.sha}}.apk
if-no-files-found: error
37 changes: 37 additions & 0 deletions .github/workflows/android_emerge_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Emerge Android (on main commit)

on:
push:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./android

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'

- name: Emerge analysis
run: ./gradlew :app:emergeUploadReleaseAab
env:
EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }}
ANDROID_DISTRIBUTION_API_KEY: ${{ secrets.ANDROID_DISTRIBUTION_API_KEY}}
PR_SHA: ${{ github.event.after }}
PR_BASE_SHA: ${{ github.event.before }}





Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Emerge Android size analysis
name: Emerge Android (on pull request)

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
paths: [ android/** ]
Expand All @@ -19,15 +17,19 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
- name: Emerge size analysis

- name: Emerge analysis
run: ./gradlew :app:emergeUploadReleaseAab
env:
EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }}
ANDROID_DISTRIBUTION_API_KEY: ${{ secrets.ANDROID_DISTRIBUTION_API_KEY}}
PR_SHA: ${{ github.event.pull_request.head.sha }}
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}


36 changes: 36 additions & 0 deletions .github/workflows/android_emerge_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Emerge Android (on release)

on:
release:
types: [ draft ]

jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./android

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'

- name: Emerge analysis
run: ./gradlew :app:emergeUploadReleaseAab
env:
EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }}
ANDROID_DISTRIBUTION_API_KEY: ${{ secrets.ANDROID_DISTRIBUTION_API_KEY}}
PR_SHA: ${{ github.event.pull_request.head.sha }} # TODO: fix
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} # TODO: fix
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if we can get the sha for the previous release and I can add first-class to Gradle plugin





100 changes: 0 additions & 100 deletions .github/workflows/android_release_build.yml

This file was deleted.