165 lines
6.1 KiB
YAML
165 lines
6.1 KiB
YAML
name: Build app
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
obfuscate:
|
|
description: Obfuscate
|
|
default: false
|
|
type: boolean
|
|
buildAndroid:
|
|
description: Build for Android
|
|
required: true
|
|
default: true
|
|
type: boolean
|
|
buildWindowsX64:
|
|
description: Build for Windows x64
|
|
required: true
|
|
default: false
|
|
type: boolean
|
|
buildLinuxX64:
|
|
description: Build for Linux x64
|
|
required: true
|
|
default: false
|
|
type: boolean
|
|
|
|
jobs:
|
|
analyze:
|
|
name: Linting
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
result: ${{ steps.version.outputs.result }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: 3.29.0
|
|
- name: Get flutter version
|
|
id: version
|
|
uses: mikefarah/yq@master
|
|
with:
|
|
cmd: yq -r '.version' 'pubspec.yaml' | awk -F'+' '{print $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.29.0
|
|
- 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: Get flutter version
|
|
id: version
|
|
uses: mikefarah/yq@master
|
|
with:
|
|
cmd: yq -r '.version' 'pubspec.yaml'
|
|
- name: Disabling flutter analytics
|
|
run: flutter config --no-analytics
|
|
- name: Running build
|
|
id: compile
|
|
run: flutter build apk --split-debug-info=build/debugAndroid ${{ github.event.inputs.obfuscate == 'true' && '--obfuscate' || '' }}
|
|
- name: Preparing files
|
|
run: |
|
|
cp build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/ollama-android-v${{ needs.analyze.outputs.result }}.apk
|
|
- name: Uploading APK
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ollama-android
|
|
path: |
|
|
build/app/outputs/flutter-apk/ollama-android-v${{ needs.analyze.outputs.result }}.apk
|
|
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.29.0
|
|
- name: Get flutter version
|
|
id: version
|
|
shell: pwsh
|
|
run: |
|
|
Invoke-WebRequest -Uri "https://github.com/mikefarah/yq/releases/latest/download/yq_windows_amd64.exe" -OutFile "yq.exe"
|
|
$flutterVersion = .\yq.exe -r '.version' pubspec.yaml
|
|
Write-Output "::set-output name=flutter_version::$flutterVersion"
|
|
- name: Disabling flutter analytics
|
|
run: flutter config --no-analytics
|
|
- name: Running build
|
|
id: compile
|
|
run: flutter build windows --split-debug-info=build\debugWindows ${{ github.event.inputs.obfuscate == 'true' && '--obfuscate' || '' }}
|
|
- name: Running installer build
|
|
uses: Minionguyjpro/Inno-Setup-Action@v1.2.2
|
|
with:
|
|
path: .\windows_installer\ollama.iss
|
|
options: /O+ /dAppVersion=${{ needs.analyze.outputs.result }}
|
|
- name: Uploading installer
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ollama-windows-x64
|
|
path: build\windows\x64\runner\ollama-windows-x64-v${{ needs.analyze.outputs.result }}.exe
|
|
build-linux-x64:
|
|
name: Building for Linux x64
|
|
if: ${{ github.event.inputs.buildLinuxX64 == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
needs: analyze
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: 3.29.0
|
|
- name: Get flutter version
|
|
id: version
|
|
uses: mikefarah/yq@master
|
|
with:
|
|
cmd: yq -r '.version' 'pubspec.yaml'
|
|
- name: Disabling flutter analytics
|
|
run: flutter config --no-analytics
|
|
- name: Installing linux dependencies
|
|
run: |
|
|
sudo apt-get update -y
|
|
sudo apt-get install -y ninja-build libgtk-3-dev
|
|
- name: Running build
|
|
id: compile
|
|
run: flutter build linux --split-debug-info=build/debugLinux ${{ github.event.inputs.obfuscate == 'true' && '--obfuscate' || '' }}
|
|
- name: Creating archive
|
|
run: |
|
|
cd build/linux/x64/release/bundle
|
|
tar -czf ollama-linux-x64-v${{ needs.analyze.outputs.result }}.tar.gz *
|
|
- name: Uploading archive
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ollama-linux-x64
|
|
path: build/linux/x64/release/bundle/ollama-linux-x64-v${{ needs.analyze.outputs.result }}.tar.gz
|
|
bundle:
|
|
name: Creating bundle
|
|
runs-on: ubuntu-latest
|
|
if: ${{ always() }}
|
|
needs: [build-android, build-windows-x64, build-linux-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: ./
|