mirror of
https://github.com/vleeuwenmenno/supplements.git
synced 2025-09-11 18:29:12 +02:00
feat: Add GitHub Actions workflows for building and releasing Android, iOS, Linux, and Windows applications
This commit is contained in:
184
.github/workflows/linux-build.yml
vendored
Normal file
184
.github/workflows/linux-build.yml
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
# .github/workflows/linux-build-github.yml
|
||||
name: Build Linux Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and Upload Linux Release
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.repository_owner == 'vleeuwenmenno' && contains(github.server_url, 'github.com')
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: "stable"
|
||||
|
||||
- name: Enable Linux desktop support
|
||||
run: flutter config --enable-linux-desktop
|
||||
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
# Fix GPG key issues
|
||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 871920D1991BC93C
|
||||
sudo apt-get update -y
|
||||
# Install dependencies needed for Flutter Linux builds and appimage-builder
|
||||
sudo apt-get install -y clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev \
|
||||
python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace pipx squashfs-tools zsync \
|
||||
python3-venv python3-dev appstream
|
||||
|
||||
- name: Get dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: Build Linux release
|
||||
run: flutter build linux --release
|
||||
|
||||
- name: Extract version
|
||||
id: version
|
||||
run: |
|
||||
APP_VERSION=$(grep 'version:' pubspec.yaml | sed 's/version: //g' | sed 's/+.*//g')
|
||||
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Zip bundle directory
|
||||
run: |
|
||||
cd build/linux/x64/release
|
||||
zip -r ../../../../supplements_${{ env.APP_VERSION }}_amd64_linux.zip bundle/*
|
||||
cd ../../../../ # Go back to the root directory
|
||||
|
||||
- name: Download and extract AppImageTool
|
||||
run: |
|
||||
wget -O appimagetool-x86_64.AppImage https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||
chmod +x appimagetool-x86_64.AppImage
|
||||
# Extract AppImageTool to avoid FUSE dependency issues in containers
|
||||
./appimagetool-x86_64.AppImage --appimage-extract
|
||||
# The extracted tool will be in squashfs-root/AppRun
|
||||
|
||||
- name: Create AppDir structure using Flutter bundle
|
||||
run: |
|
||||
# Verify Flutter build exists
|
||||
echo "Verifying Flutter build..."
|
||||
if [[ ! -d "build/linux/x64/release/bundle" ]]; then
|
||||
echo "Error: Flutter build directory not found!"
|
||||
ls -la build/linux/x64/release/ || echo "Release directory doesn't exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "build/linux/x64/release/bundle/supplements" ]]; then
|
||||
echo "Error: supplements executable not found!"
|
||||
ls -la build/linux/x64/release/bundle/
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create AppDir and copy the entire Flutter bundle
|
||||
echo "Creating AppDir with Flutter bundle..."
|
||||
mkdir -p AppDir
|
||||
cp -r build/linux/x64/release/bundle AppDir/
|
||||
|
||||
# Create required directories for AppImage structure
|
||||
mkdir -p AppDir/usr/share/applications
|
||||
mkdir -p AppDir/usr/share/icons/hicolor/64x64/apps
|
||||
|
||||
# Copy icon
|
||||
echo "Copying application icon..."
|
||||
if [[ -f "android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png" ]]; then
|
||||
# Copy to standard location
|
||||
cp android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png AppDir/usr/share/icons/hicolor/64x64/apps/
|
||||
# Also copy to AppDir root with the name referenced in desktop file
|
||||
cp android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png AppDir/ic_launcher.png
|
||||
else
|
||||
echo "Warning: Icon not found, trying other locations..."
|
||||
ICON_FILE=$(find android/app/src/main/res/ -name "ic_launcher.png" | head -1)
|
||||
if [[ -n "$ICON_FILE" ]]; then
|
||||
cp "$ICON_FILE" AppDir/usr/share/icons/hicolor/64x64/apps/
|
||||
cp "$ICON_FILE" AppDir/ic_launcher.png
|
||||
else
|
||||
echo "No icon found"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create desktop file (AppImageTool looks for it in the root of AppDir)
|
||||
echo "Creating desktop file..."
|
||||
cat > AppDir/supplements.desktop << 'EOF'
|
||||
[Desktop Entry]
|
||||
Name=supplements
|
||||
Exec=AppRun
|
||||
Icon=ic_launcher
|
||||
Type=Application
|
||||
Categories=Utility;
|
||||
EOF
|
||||
|
||||
# Also create it in the standard location for completeness
|
||||
cp AppDir/supplements.desktop AppDir/usr/share/applications/supplements.desktop
|
||||
|
||||
# Create AppRun script that uses the Flutter bundle directly
|
||||
echo "Creating AppRun script..."
|
||||
cat > AppDir/AppRun << 'EOF'
|
||||
#!/bin/bash
|
||||
HERE="$(dirname "$(readlink -f "${0}")")"
|
||||
cd "${HERE}/bundle"
|
||||
exec "./supplements" "$@"
|
||||
EOF
|
||||
chmod +x AppDir/AppRun
|
||||
|
||||
echo "AppDir structure created successfully!"
|
||||
echo "AppDir contents:"
|
||||
ls -la AppDir/
|
||||
echo "Bundle contents:"
|
||||
ls -la AppDir/bundle/
|
||||
echo "Desktop file verification:"
|
||||
ls -la AppDir/*.desktop
|
||||
echo "Icon verification:"
|
||||
ls -la AppDir/usr/share/icons/hicolor/64x64/apps/
|
||||
|
||||
- name: Build AppImage manually
|
||||
run: |
|
||||
# Verify AppDir structure before building
|
||||
echo "Verifying AppDir structure..."
|
||||
if [[ ! -f "AppDir/AppRun" ]]; then
|
||||
echo "Error: AppRun not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "AppDir/bundle/supplements" ]]; then
|
||||
echo "Error: supplements executable not found in AppDir/bundle/!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Build AppImage using extracted appimagetool (avoids FUSE issues)
|
||||
echo "Building AppImage..."
|
||||
ARCH=amd64 ./squashfs-root/AppRun AppDir supplements-latest-amd64.AppImage
|
||||
|
||||
# Check if AppImage was created successfully
|
||||
if [[ -f "supplements-latest-amd64.AppImage" ]]; then
|
||||
echo "AppImage created successfully!"
|
||||
ls -la supplements-latest-amd64.AppImage
|
||||
else
|
||||
echo "Error: AppImage creation failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Debug release information
|
||||
run: |
|
||||
echo "Release tag: ${{ github.event.release.tag_name }}"
|
||||
echo "Release name: ${{ github.event.release.name }}"
|
||||
echo "Release URL: ${{ github.event.release.html_url }}"
|
||||
echo "App version: ${{ env.APP_VERSION }}"
|
||||
|
||||
- name: Upload Linux Zip to GitHub Release
|
||||
run: |
|
||||
gh release upload "${{ github.event.release.tag_name }}" "supplements_${{ env.APP_VERSION }}_amd64_linux.zip" --clobber
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload Linux AppImage to GitHub Release
|
||||
run: |
|
||||
gh release upload "${{ github.event.release.tag_name }}" "supplements-latest-amd64.AppImage" --clobber
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
Reference in New Issue
Block a user