Files
flutter/.github/workflows/build-linux.yml
2026-07-24 18:36:32 +02:00

106 lines
3.4 KiB
YAML

name: Build Linux
on:
workflow_dispatch:
inputs:
ref:
description: 'Branch/Tag to build'
required: true
default: 'master'
generate_manifest:
description: 'Update flathub manifest'
type: boolean
default: false
workflow_call:
inputs:
ref:
required: true
type: string
generate_manifest:
type: boolean
default: true
secrets:
SSH_DEPLOY_KEY:
required: true
permissions:
contents: read
jobs:
# TODO: note that we currently only build for x64, as arm64 is not supported by
# subosito/flutter-action@v2 yet and we don't want to install flutter manually
# just for this workflow: https://github.com/subosito/flutter-action/issues/345
build_linux:
name: Build application - ${{ matrix.platform }}
runs-on: ${{ matrix.runner }}
outputs:
flutter_sdk_version: ${{ steps.flutter-version.outputs.flutter_sdk_version }}
strategy:
matrix:
include:
- platform: x64
runner: ubuntu-latest
# - platform: arm64
# runner: ubuntu-24.04-arm
steps:
- name: Checkout application
uses: actions/checkout@v7
with:
ref: ${{ inputs.ref }}
- name: Read Flutter SDK version
id: flutter-version
run: |
flutter_sdk_version=$(grep 'flutter-version:' .github/actions/flutter-common/action.yml | awk '{print $2}')
echo "flutter_sdk_version=$flutter_sdk_version" >> "$GITHUB_OUTPUT"
- name: Common setup
uses: ./.github/actions/flutter-common
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
- name: Build application for linux
run: |
sudo apt update
sudo apt install -y pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev libsecret-1-dev libjsoncpp-dev --no-install-recommends
flutter build linux --release
tar -zcvf linux-${{ matrix.platform }}.tar.gz build/linux/${{ matrix.platform }}/release/bundle
- uses: actions/upload-artifact@v7
with:
name: builds-linux
path: |
linux-${{ matrix.platform }}.tar.gz
generate_flathub_manifest:
runs-on: ubuntu-latest
name: Update flathub manifest
if: ${{ inputs.generate_manifest }}
# If the job fails just continue, this can be done manually later
continue-on-error: true
needs:
- build_linux
steps:
- name: Checkout flatpak-flathub repo
uses: actions/checkout@v7
with:
repository: wger-project/de.wger.flutter
ssh-key: ${{ secrets.SSH_DEPLOY_KEY }}
- name: Bump version and update manifest
run: |
git clone https://github.com/TheAppgineer/flatpak-flutter.git --branch 0.15.0 ../flatpak-flutter
pip install -r ../flatpak-flutter/requirements.txt
python bump-versions.py ${{ inputs.ref }} ${{ needs.build_linux.outputs.flutter_sdk_version }}
../flatpak-flutter/flatpak-flutter.py --app-module wger flatpak-flutter.yml
- name: Push updated config to flathub repository
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git checkout -b release-${{ inputs.ref }}
git add -A
git commit -m "Update to ${{ inputs.ref }}"
git push origin release-${{ inputs.ref }}