Skip to content

Commit

Permalink
Add android build
Browse files Browse the repository at this point in the history
  • Loading branch information
duddu committed Oct 15, 2023
1 parent 493168e commit 55f9491
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 8 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
build-folder: build
build-artifact: web
environment: onrender
- platform: appbundle
os: ubuntu-latest
build-folder: xxx
build-artifact: xxx
- platform: macos
os: macos-latest
build-folder: build/macos/Build/Products/Release
Expand All @@ -36,6 +40,15 @@ jobs:
needs: trigger-test
environment: ${{ matrix.environment }}
steps:
- name: '[appbundle] Setup java'
if: ${{ matrix.platform == 'appbundle' }}
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: '[appbundle] Setup android sdk'
if: ${{ matrix.platform == 'appbundle' }}
uses: android-actions/setup-android@v3
- name: Prepare flutter
uses: subosito/flutter-action@v2
with:
Expand All @@ -58,8 +71,16 @@ jobs:
- name: '[linux] Install dependencies'
if: ${{ matrix.platform == 'linux' }}
run: sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
- name: '[appbundle] Setup upload keystore'
if: ${{ matrix.platform == 'appbundle' }}
run: |
echo "${{ secrets.ANDROID_UPLOAD_KEYSTORE_ASC }}" > /home/runner/upload-keystore.jks.asc
gpg -d --passphrase "${{ secrets.ANDROID_UPLOAD_KEYSTORE_ASC_PASSPHRASE }}" --batch /home/runner/upload-keystore.jks.asc > /home/runner/upload-keystore.jks
echo "storePassword=${{ secrets.ANDROID_UPLOAD_KEYSTORE_PASSWORD }}\nkeyPassword=${{ secrets.ANDROID_UPLOAD_KEYSTORE_PASSWORD }}\nkeyAlias=upload\nstoreFile=/home/runner/upload-keystore.jks" > android/key.properties
ls -la /home/runner/
cat android/key.properties
- name: Build release
run: flutter build -v ${{ matrix.platform }} --release --build-name=${{ env.VERSION }} --build-number=${{ github.sha }} --dart-define=VERSION=${{ env.VERSION }} --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=REPO_URL=${{ github.server_url }}/${{ github.repository }} ${{ matrix.platform == 'web' && '--csp' || '' }}
run: flutter build -v ${{ matrix.platform }} --release --build-name=${{ env.VERSION }} --build-number=${{ matrix.platform == 'appbundle' && 1 || github.sha }} --dart-define=VERSION=${{ env.VERSION }} --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=REPO_URL=${{ github.server_url }}/${{ github.repository }} ${{ matrix.platform == 'web' && '--csp' || '' }}
- name: '[web] Trigger deploy on Render'
if: ${{ matrix.platform == 'web' }}
uses: JamesIves/github-pages-deploy-action@v4
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Your ultimate companion for perfect sourdough - Calculate every variable from mixing to fermentation for the ideal sourdough baking experience. Try it now:

[![Launch web app](https://img.shields.io/badge/Launch_web_app-red?logo=googlechrome&logoColor=white)](https://sourdoc.duddu.dev)
[![Download Android app](https://img.shields.io/badge/Download_Android_app-silver?logo=android&logoColor=white&color=02b955)](https://sourdoc.duddu.dev/download-release-asset.html?platform=appbundle)
[![Download macOS app](https://img.shields.io/badge/Download_macOS_app-silver?logo=apple&logoColor=grey)](https://sourdoc.duddu.dev/download-release-asset.html?platform=macos)
[![Download Windows app](https://img.shields.io/badge/Download_Windows_app-0061bb?logo=windows&logoColor=white)](https://sourdoc.duddu.dev/download-release-asset.html?platform=windows)
[![Download Linux app](https://img.shields.io/badge/Download_Linux_app-grey?logo=linux&logoColor=white)](https://sourdoc.duddu.dev/download-release-asset.html?platform=linux)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.20
1.4.21
18 changes: 15 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
namespace "com.example.sourdoc"
compileSdkVersion flutter.compileSdkVersion
Expand Down Expand Up @@ -51,11 +57,17 @@ android {
versionName flutterVersionName
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="sourdoc"
android:label="Sourdoc"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
2 changes: 1 addition & 1 deletion web/download-release-asset.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Download Sourdoc release asset</title>
<script>
const version = '1.4.20';
const version = '1.4.21';
const platform = new URLSearchParams(window.location.search).get('platform');
window.location.href = 'https://github.com/duddu/sourdoc/releases/download/v' + version + '/' + platform + '-sourdoc-' + version + '.tgz';
</script>
Expand Down
2 changes: 1 addition & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ZS2J7KXZ0Q"></script>
<script defer src="gtm-gtag.js"></script>
<script>
const serviceWorkerVersion = '1.4.20';
const serviceWorkerVersion = '1.4.21';
</script>
<script defer src="flutter.js"></script>
</head>
Expand Down

0 comments on commit 55f9491

Please sign in to comment.