Skip to content

Commit

Permalink
more reusuable workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
danemadsen committed Apr 21, 2024
1 parent 395e6a3 commit c481d92
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 93 deletions.
61 changes: 3 additions & 58 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,13 @@
name: Build Android

on:
release:
types: [published]
push:
branches:
- main
- dev

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

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

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.5'

- name: Decode Keystore File
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
run: echo "$KEYSTORE" | base64 --decode > android/app/key.jks

- name: Create key.properties
run: |
echo "storeFile=key.jks" > android/key.properties
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
echo "releasePassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
echo "releaseAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
- name: Setup Flutter
run: |
flutter config --no-analytics
flutter pub get
- name: Build APK
run: |
flutter build apk --split-per-abi
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: maid-android-apk
path: build/app/outputs/apk/release

- name: Build appbundle
run: |
flutter build appbundle
- name: Upload AAB
uses: actions/upload-artifact@v4
with:
name: maid-android-aab
path: build/app/outputs/bundle/release/app-release.aab
uses: ./.github/workflows/reusable-build-android.yml
with:
flutter_version: '3.19.5'
39 changes: 4 additions & 35 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,13 @@
name: Build Windows

on:
release:
types: [published]
push:
branches:
- main
- dev

jobs:
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.5'

- name: Install dependencies
run: |
choco install -y cmake ninja
- name: Install Vulkan SDK
uses: humbletim/[email protected]
with:
version: latest
cache: true

- name: Build Windows App
run: |
flutter pub get
flutter build windows
- name: Upload Windows Build
uses: actions/upload-artifact@v4
with:
name: maid-windows
path: build/windows/x64/bundle
uses: ./.github/workflows/reusable-build-windows.yml
with:
flutter_version: '3.19.5'
66 changes: 66 additions & 0 deletions .github/workflows/reusable-build-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Reusable Build Android
on:
workflow_call:
inputs:
flutter_version:
required: true
type: string

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

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

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.flutter_version }}

- name: Decode Keystore File
env:
KEYSTORE: ${{ secrets.KEYSTORE }}
run: echo "$KEYSTORE" | base64 --decode > android/app/key.jks

- name: Create key.properties
run: |
echo "storeFile=key.jks" > android/key.properties
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
echo "releasePassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
echo "releaseAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
- name: Setup Flutter
run: |
flutter config --no-analytics
flutter pub get
- name: Build APK
run: |
flutter build apk --split-per-abi
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: maid-android-apk
path: build/app/outputs/apk/release

- name: Build appbundle
run: |
flutter build appbundle
- name: Upload AAB
uses: actions/upload-artifact@v4
with:
name: maid-android-aab
path: build/app/outputs/bundle/release/app-release.aab
41 changes: 41 additions & 0 deletions .github/workflows/reusable-build-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Reusable Build Windows
on:
workflow_call:
inputs:
flutter_version:
required: true
type: string
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.flutter_version }}

- name: Install dependencies
run: |
choco install -y cmake ninja
- name: Install Vulkan SDK
uses: humbletim/[email protected]
with:
version: latest
cache: true

- name: Build Windows App
run: |
flutter pub get
flutter build windows
- name: Upload Windows Build
uses: actions/upload-artifact@v4
with:
name: maid-windows
path: build/windows/x64/bundle

0 comments on commit c481d92

Please sign in to comment.