mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
227 lines
6.0 KiB
YAML
227 lines
6.0 KiB
YAML
name: Build And Upload Release Assets
|
|
|
|
on:
|
|
push:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
FLUTTER_VERSION: "3.35.6"
|
|
APP_NAME: meshcore-sar
|
|
|
|
jobs:
|
|
build-android:
|
|
name: Build Android APK
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: "17"
|
|
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: ${{ env.FLUTTER_VERSION }}
|
|
channel: stable
|
|
cache: true
|
|
|
|
- name: Install dependencies
|
|
run: flutter pub get
|
|
|
|
- name: Build APK
|
|
run: flutter build apk --release
|
|
|
|
- name: Prepare APK artifact
|
|
run: |
|
|
RAW_TAG="${{ github.event.release.tag_name || github.ref_name }}"
|
|
TAG="${RAW_TAG//\//-}"
|
|
cp build/app/outputs/flutter-apk/app-release.apk "${APP_NAME}-${TAG}-android.apk"
|
|
|
|
- name: Upload APK artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-android
|
|
path: "${{ env.APP_NAME }}-*-android.apk"
|
|
if-no-files-found: error
|
|
|
|
build-linux:
|
|
name: Build Linux App
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Linux build dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
clang \
|
|
cmake \
|
|
ninja-build \
|
|
pkg-config \
|
|
libgtk-3-dev \
|
|
liblzma-dev \
|
|
libgstreamer1.0-dev \
|
|
libgstreamer-plugins-base1.0-dev
|
|
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: ${{ env.FLUTTER_VERSION }}
|
|
channel: stable
|
|
cache: true
|
|
|
|
- name: Enable Linux desktop
|
|
run: flutter config --enable-linux-desktop
|
|
|
|
- name: Install dependencies
|
|
run: flutter pub get
|
|
|
|
- name: Build Linux release
|
|
run: flutter build linux --release
|
|
|
|
- name: Package Linux artifact
|
|
run: |
|
|
RAW_TAG="${{ github.event.release.tag_name || github.ref_name }}"
|
|
TAG="${RAW_TAG//\//-}"
|
|
tar -C build/linux/x64/release -czf "${APP_NAME}-${TAG}-linux.tar.gz" bundle
|
|
|
|
- name: Upload Linux artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-linux
|
|
path: "${{ env.APP_NAME }}-*-linux.tar.gz"
|
|
if-no-files-found: error
|
|
|
|
build-windows:
|
|
name: Build Windows App
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: ${{ env.FLUTTER_VERSION }}
|
|
channel: stable
|
|
cache: true
|
|
|
|
- name: Enable Windows desktop
|
|
shell: pwsh
|
|
run: flutter config --enable-windows-desktop
|
|
|
|
- name: Install dependencies
|
|
shell: pwsh
|
|
run: flutter pub get
|
|
|
|
- name: Build Windows release
|
|
shell: pwsh
|
|
run: flutter build windows --release
|
|
|
|
- name: Package Windows artifact
|
|
shell: pwsh
|
|
run: |
|
|
$RawTag = "${{ github.event.release.tag_name || github.ref_name }}"
|
|
$Tag = $RawTag -replace '/', '-'
|
|
$Output = "${{ env.APP_NAME }}-$Tag-windows.zip"
|
|
Compress-Archive -Path "build/windows/x64/runner/Release/*" -DestinationPath $Output
|
|
|
|
- name: Upload Windows artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-windows
|
|
path: "${{ env.APP_NAME }}-*-windows.zip"
|
|
if-no-files-found: error
|
|
|
|
build-macos:
|
|
name: Build macOS DMG
|
|
runs-on: macos-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
flutter-version: ${{ env.FLUTTER_VERSION }}
|
|
channel: stable
|
|
cache: true
|
|
|
|
- name: Enable macOS desktop
|
|
run: flutter config --enable-macos-desktop
|
|
|
|
- name: Install dependencies
|
|
run: flutter pub get
|
|
|
|
- name: Build macOS release
|
|
run: flutter build macos --release
|
|
|
|
- name: Create DMG
|
|
run: |
|
|
RAW_TAG="${{ github.event.release.tag_name || github.ref_name }}"
|
|
TAG="${RAW_TAG//\//-}"
|
|
APP_PATH=$(find build/macos/Build/Products/Release -maxdepth 1 -name "*.app" -print -quit)
|
|
if [ -z "$APP_PATH" ]; then
|
|
echo "No .app bundle found in build output"
|
|
exit 1
|
|
fi
|
|
hdiutil create -volname "MeshCore SAR" -srcfolder "$APP_PATH" -ov -format UDZO "${APP_NAME}-${TAG}-macos.dmg"
|
|
|
|
- name: Upload macOS artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release-macos
|
|
path: "${{ env.APP_NAME }}-*-macos.dmg"
|
|
if-no-files-found: error
|
|
|
|
upload-release-assets:
|
|
name: Upload Assets To Release
|
|
if: github.event_name == 'release'
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build-android
|
|
- build-linux
|
|
- build-windows
|
|
- build-macos
|
|
|
|
steps:
|
|
- name: Download all build artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
pattern: release-*
|
|
path: dist
|
|
merge-multiple: true
|
|
|
|
- name: Upload assets to published release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ github.event.release.tag_name || github.ref_name }}
|
|
body: |
|
|
Release assets are published for all supported build targets:
|
|
- Android (`.apk`)
|
|
- Linux (`.tar.gz`)
|
|
- macOS (`.dmg`)
|
|
- Windows (`.zip`)
|
|
|
|
Windows status: currently unusable. The BLE stack on Windows is broken, so BLE features do not work.
|
|
files: |
|
|
dist/*.apk
|
|
dist/*.tar.gz
|
|
dist/*.zip
|
|
dist/*.dmg
|
|
fail_on_unmatched_files: true
|