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

Github Actions workflow #175

Open
wants to merge 8 commits into
base: master
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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
push:
branches:
- main

jobs:
ci:
name: Application Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Run tests and Build with Gradle
run: |
./gradlew testGithubReleaseUnitTest
96 changes: 96 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Release

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

permissions:
contents: write

env:
VERSION: ''
APK_PATH: app/build/outputs/apk/
BUNDLE_PATH: app/build/outputs/bundle/

jobs:
build:
strategy:
matrix:
flavor: [ github, googleplay, amazon ]

name: Build APK
runs-on: ubuntu-latest

steps:
- name: Save release version
run: |
VERSION=${{ github.ref_name }}
echo "VERSION=${VERSION:1}" >> $GITHUB_ENV

- id: flavorString
uses: ASzc/change-string-case-action@v6
with:
string: ${{ matrix.flavor }}

- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle

- name: Checkout keystore repo
uses: actions/checkout@v4
with:
repository: ${{ secrets.KEYSTORE_GIT_REPOSITORY }}
token: ${{ secrets.KEYSTORE_ACCESS_TOKEN }}
path: app/keystore

- name: Prepare signing properties
run: |
mkdir signing && touch signing/release.properties
echo "storeFile=${{ secrets.KEYSTORE_FILE }}" >> signing/release.properties
echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" >> signing/release.properties
echo "keyAlias=${{ secrets.RELEASE_SIGN_KEY_ALIAS }}" >> signing/release.properties
echo "keyPassword=${{ secrets.RELEASE_SIGN_KEY_PASSWORD }}" >> signing/release.properties

touch signing/legacy.properties
echo "storeFile=${{ secrets.KEYSTORE_FILE }}" >> signing/legacy.properties
echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" >> signing/legacy.properties
echo "keyAlias=${{ secrets.RELEASE_SIGN_KEY_ALIAS }}" >> signing/legacy.properties
echo "keyPassword=${{ secrets.RELEASE_SIGN_KEY_PASSWORD }}" >> signing/legacy.properties

- name: Run ${{ steps.flavorString.outputs.capitalized }} Build
if: matrix.flavor == 'github'
run: ./gradlew assemble${{ steps.flavorString.outputs.capitalized }}Release --stacktrace

- name: Run ${{ steps.flavorString.outputs.capitalized }} Build
if: matrix.flavor != 'github'
run: ./gradlew bundle${{ steps.flavorString.outputs.capitalized }}Release

- name: Upload ${{ steps.flavorString.outputs.capitalized }} Release APK
if: matrix.flavor == 'github'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.flavor }}-release.apk
path: ${{ env.APK_PATH }}${{ matrix.flavor }}/release/app-${{ matrix.flavor }}-release.apk

- name: Upload ${{ steps.flavorString.outputs.capitalized }} Bundle
if: matrix.flavor != 'github'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.flavor }}-release.aab
path: ${{ env.BUNDLE_PATH }}${{ matrix.flavor }}Release/app-${{ matrix.flavor }}-release.aab

- name: Upload ${{ steps.flavorString.outputs.capitalized }} apk to GH release
if: matrix.flavor == 'github'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: ${{ env.APK_PATH }}${{ matrix.flavor }}/release/app-${{ matrix.flavor }}-release.apk
asset_name: aerial-views-${{ env.VERSION }}.apk
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,6 @@ lint/tmp/

# macOS
*.DS_Store

# Secrets file for Act
.secrets