Added GitHub Action
This commit is contained in:
parent
92290d6428
commit
00b0705038
|
@ -0,0 +1,108 @@
|
|||
name: Build Script
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
buildAndroid:
|
||||
description: Build for Android
|
||||
required: true
|
||||
default: true
|
||||
type: boolean
|
||||
buildWindowsX64:
|
||||
description: Build for Windows x64
|
||||
required: true
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Linting
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: 3.22.1
|
||||
- name: Disabling flutter analytics
|
||||
run: flutter config --no-analytics
|
||||
- name: Analyzing project code
|
||||
run: flutter analyze --no-fatal-infos
|
||||
build-android:
|
||||
name: Building for Android
|
||||
if: ${{ github.event.inputs.buildAndroid == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: analyze
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: 3.22.1
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: "adopt"
|
||||
java-version: "17"
|
||||
- name: Copy keystore file
|
||||
run: |
|
||||
echo $'storePassword=${{ secrets.ANDROID_KEYSTORE_PASSPHRASE }}\nkeyPassword=${{ secrets.ANDROID_KEYSTORE_PASSPHRASE }}\nkeyAlias=upload\nstoreFile=upload-keystore.jks\n' > ./android/key.properties
|
||||
echo "${{ secrets.ANDROID_KEYSTORE }}" > ./android/app/upload-keystore.jks.asc
|
||||
gpg -d --passphrase "${{ secrets.ANDROID_KEYSTORE_PASSPHRASE }}" --batch ./android/app/upload-keystore.jks.asc > ./android/app/upload-keystore.jks
|
||||
- name: Disabling flutter analytics
|
||||
run: flutter config --no-analytics
|
||||
- name: Running build
|
||||
id: compile
|
||||
run: flutter build apk --obfuscate --split-debug-info=build/debugAndroid
|
||||
- name: Preparing files
|
||||
run: |
|
||||
cp build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/ollama.apk
|
||||
cp build/app/outputs/flutter-apk/app-release.apk.sha1 build/app/outputs/flutter-apk/ollama.apk.sha1
|
||||
- name: Uploading APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ollama-android
|
||||
path: |
|
||||
build/app/outputs/flutter-apk/ollama.apk
|
||||
build/app/outputs/flutter-apk/ollama.apk.sha1
|
||||
build-windows-x64:
|
||||
name: Building for Windows x64
|
||||
if: ${{ github.event.inputs.buildWindowsX64 == 'true' }}
|
||||
runs-on: windows-latest
|
||||
needs: analyze
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
flutter-version: 3.22.1
|
||||
- name: Get flutter version
|
||||
id: get_flutter_version
|
||||
uses: its404/get-flutter-version@v1.0.0
|
||||
- name: Disabling flutter analytics
|
||||
run: flutter config --no-analytics
|
||||
- name: Running build
|
||||
id: compile
|
||||
run: flutter build windows --obfuscate --split-debug-info=build\debugWindows
|
||||
- name: Running installer build
|
||||
uses: Minionguyjpro/Inno-Setup-Action@v1.2.2
|
||||
with:
|
||||
path: .\windows_installer\x64.iss
|
||||
options: /O+ /dAppVersion=${{ steps.get_flutter_version.outputs.version_number }}
|
||||
- name: Uploading installer
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ollama-windows-x64
|
||||
path: build\windows\x64\runner\ollama-v${{ steps.get_flutter_version.outputs.version_number }}-x64.exe
|
||||
bundle:
|
||||
name: Creating bundle
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ always() }}
|
||||
needs: [build-android, build-windows-x64]
|
||||
steps:
|
||||
- name: Adding builds
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
merge-multiple: true
|
||||
- name: Generating timestamp
|
||||
run: echo "timestamp=$EPOCHSECONDS"$'\n\norigin={{ github.repository }}\nhost={{ github.server_url }}\nowner={{ github.repository_owner }}\n\nworkflow={{ github.workflow }}\nrun_id={{ github.run_id }}\nrun_number={{ github.run_number }}' > manifest.yaml
|
||||
- name: Bundling files
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ollama
|
||||
path: ./
|
Loading…
Reference in New Issue