Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
#22 to separate file
Browse files Browse the repository at this point in the history
(disabled push hook)
  • Loading branch information
niusounds committed Dec 10, 2023
1 parent 796886d commit 8444713
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 1 deletion.
78 changes: 78 additions & 0 deletions .github/workflows/build_and_release_apk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build and release app

on:
# push:
workflow_dispatch:

jobs:
Android:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
with:
fetch-depth: '0'

- name: Get commit hash
run: echo "CommitHashShort=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Get commit count
run: echo "CommitCount=$(git rev-list --count HEAD)" >> $GITHUB_ENV

- name: Get current date
run: echo "CurrentDate=$(date +'%Y-%m-%d')" >> $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

- name: Run gradle tests
run: ./gradlew test

- name: Build gradle project
run: ./gradlew build

- name: Build apk debug project (APK) - app module
run: ./gradlew assembleDebug

- name: Build apk release project (APK) - app module
run: ./gradlew assemble

- name: Build app bundle release (AAB) - app module
run: ./gradlew app:bundleRelease

- name: Upload APK Debug - ${{github.event.repository.name}}
uses: actions/upload-artifact@v3
with:
name: ${{env.CurrentDate}}_${{github.event.repository.name}}_r${{env.CommitCount}}@${{env.CommitHashShort}} - Debug
path: app/build/outputs/apk/debug/

- name: Upload APK Release - ${{github.event.repository.name}}
uses: actions/upload-artifact@v3
with:
name: ${{env.CurrentDate}}_${{github.event.repository.name}}_r${{env.CommitCount}}@${{env.CommitHashShort}} - Release
path: app/build/outputs/apk/release/

- name: Upload AAB (App Bundle) Release - ${{github.event.repository.name}}
uses: actions/upload-artifact@v3
with:
name: ${{env.CurrentDate}}_${{github.event.repository.name}}_r${{env.CommitCount}}@${{env.CommitHashShort}} - App bundle
path: app/build/outputs/bundle/release/

- name: Copy APK
run: cp "app/build/outputs/apk/debug/app-debug.apk" "app/build/outputs/apk/debug/${{github.event.repository.name}}.apk"

- name: GitHub pre-release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{secrets.GITHUB_TOKEN}}"
automatic_release_tag: "latest"
prerelease: false
title: "[${{env.CurrentDate}}] ${{github.event.repository.name}} r${{env.CommitCount}}@${{env.CommitHashShort}}"
files: "app/build/outputs/apk/debug/${{github.event.repository.name}}.apk"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Android CI
name: Check for PR

on:
push:
Expand Down

0 comments on commit 8444713

Please sign in to comment.