This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Flutter Linux App as AppImage | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-appimage: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Install Flutter SDK | |
- name: Install Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.24.3' | |
# Install AppImage and Linux dependencies | |
- name: Install AppImage and Linux dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev libblkid-dev e2fslibs-dev liblzma-dev libmpv-dev mpv ninja-build fuse | |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | |
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage | |
chmod +x linuxdeploy-x86_64.AppImage appimagetool-x86_64.AppImage | |
# Fetch Flutter dependencies | |
- name: Install Flutter dependencies | |
run: flutter pub get | |
# Run Flutter build for Linux | |
- name: Build Flutter Linux App | |
run: flutter build linux | |
- name: List build directory | |
run: | | |
ls -R build/linux/x64/release/bundle | |
# Ensure executable permissions | |
- name: Set executable permissions | |
run: chmod +x build/linux/x64/release/bundle/open_media_server_app | |
# Package the built Linux app into an AppImage | |
- name: Create AppImage | |
run: | | |
./linuxdeploy-x86_64.AppImage \ | |
--appdir=build/linux/x64/release/bundle \ | |
--output appimage \ | |
--desktop-file=assets/desktop/myapp.desktop \ | |
--icon-file assets/images/myapp.png | |
# Upload the AppImage as an artifact (optional) | |
- name: Upload AppImage artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: my-flutter-app.AppImage | |
path: '*.AppImage' | |
build-apk: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
# Install Flutter SDK | |
- name: Install Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.24.3' | |
# Fetch Flutter dependencies | |
- name: Install Flutter dependencies | |
run: flutter pub get | |
# Run Flutter build for Linux | |
- name: Build Flutter Linux App | |
run: flutter build apk | |
- run: ls -R | |
# Upload the AppImage as an artifact | |
- name: Upload AppImage artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: my-flutter-app.apk | |
path: "./build/app/outputs/apk/release/app-release.apk" | |
build-web: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Install Flutter SDK | |
- name: Install Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.24.3' | |
# Fetch Flutter dependencies | |
- name: Install Flutter dependencies | |
run: flutter pub get | |
- run: flutter build web | |
working-directory: ./ | |
shell: bash | |
- name: Upload a Build Artifact | |
uses: actions/[email protected] | |
with: | |
name: web | |
path: ./build/web/ |