Skip to content

Add Linux desktop builds and publishing to the release workflows #14

Add Linux desktop builds and publishing to the release workflows

Add Linux desktop builds and publishing to the release workflows #14

Workflow file for this run

name: Pull Request Build Check
on:
pull_request:
permissions:
contents: read
concurrency:
group: pr-build-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
build-check:
name: Build Android (debug)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
cache: gradle
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.44.0'
channel: stable
cache: true
- name: Cache pub dependencies
uses: actions/cache@v5
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Install dependencies
run: flutter pub get
- name: Build APK
run: flutter build apk --debug
- uses: actions/upload-artifact@v6
with:
name: app-debug.apk
path: build/app/outputs/flutter-apk/app-debug.apk
build-windows:
name: Build Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.44.0'
channel: stable
cache: false
- name: Cache pub dependencies
uses: actions/cache@v5
with:
path: ~/AppData/Local/Pub/Cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Setup CMake 3.x
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.31.6'
- name: Install dependencies
run: flutter pub get
- name: Build Windows
run: flutter build windows --release
env:
CMAKE_POLICY_VERSION_MINIMUM: "3.5"
- uses: actions/upload-artifact@v6
with:
name: windows.zip
path: build/windows/x64/runner/Release
build-macos:
name: Build macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.44.0'
channel: stable
cache: true
- name: Cache pub dependencies
uses: actions/cache@v5
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Cache CocoaPods
uses: actions/cache@v5
with:
path: |
~/.cocoapods/repos
~/Library/Caches/CocoaPods
macos/Pods
key: ${{ runner.os }}-cocoapods-${{ hashFiles('macos/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-cocoapods-
- name: Prepare macOS dependency overrides
run: |
cat > pubspec_overrides.yaml <<'EOF'
dependency_overrides:
connectivity_plus: 6.1.4
EOF
flutter pub get
- name: Build macOS
run: flutter build macos --release
env:
FLUTTER_XCODE_CODE_SIGNING_ALLOWED: "NO"
FLUTTER_XCODE_CODE_SIGN_IDENTITY: ""
FLUTTER_XCODE_CODE_SIGNING_REQUIRED: "NO"
- uses: actions/upload-artifact@v6
with:
name: macos.app
path: build/macos/Build/Products/Release/MCCompanion.app
build-linux:
name: Build Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.44.0'
channel: stable
cache: true
- name: Cache pub dependencies
uses: actions/cache@v5
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build pkg-config
- name: Enable Linux desktop
run: flutter config --enable-linux-desktop
- name: Install dependencies
run: flutter pub get
- name: Build Linux
run: flutter build linux --release
- name: Archive Linux build
run: tar -C build/linux/x64/release -czf MCCompanion-linux-x64.tar.gz bundle
- uses: actions/upload-artifact@v6
with:
name: linux.tar.gz
path: MCCompanion-linux-x64.tar.gz