Skip to content

Commit

Permalink
feat : GH-49 Add Release workflow (#50)
Browse files Browse the repository at this point in the history
Thanks for submitting a pull request. Please include the following
information.

**What I have done and why**
Include a summary of what your pull request contains, and why you have
made these changes.

Fixes #49

**Do tests pass?**
- [x] Run local tests on `Debug` variant: `./gradlew testDebugUnitTest`
- [x] Check formatting: `./gradlew detekt ktlintCheck`
  • Loading branch information
jerryOkafor authored Jan 2, 2024
2 parents 7e3fad9 + c6bbcf7 commit fcf6980
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 3 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release - APKs

on:
push:
tags:
- 'v*'

jobs:
build:
runs-on: macos-latest
timeout-minutes: 120

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

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp ci-cd/ci-gradle.properties ~/.gradle/gradle.properties

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

- name: Install GMD image for baseline profile generation
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager "system-images;android-33;aosp_atd;x86_64"

- name: Accept Android licenses
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager --licenses || true

- name: Build release variant including baseline profile generation
run: |
./gradlew :app:assembleRelease \
-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile \
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" \
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true \
-Pandroid.experimental.androidTest.numManagedDeviceShards=1 \
-Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: false

- name: Upload app
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/release/app-release.apk
asset_name: app-release.apk
asset_content_type: application/vnd.android.package-archive
6 changes: 3 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2023 IheNkiri Project
* Copyright (c) 2024 IheNkiri Project
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -66,8 +66,8 @@ android {

signingConfig = signingConfigs.getByName("debug")

// Ensure Baseline Profile is fresh for release builds. (Note, chenge this)
baselineProfile.automaticGenerationDuringBuild = false
// Ensure Baseline Profile is fresh for release builds.
baselineProfile.automaticGenerationDuringBuild = true
}

create("benchmark") {
Expand Down

0 comments on commit fcf6980

Please sign in to comment.