update #16
This file contains hidden or 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 SimpleAI (Linux Only) | |
| permissions: | |
| contents: write | |
| on: | |
| push: | |
| branches: | |
| - "**" # prerelease builds on every push | |
| tags: | |
| - "v*" # full releases on version tags | |
| workflow_dispatch: | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| check-latest: false | |
| - name: Install Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libgtk-3-dev libwebkit2gtk-4.0-dev fuse libfuse2 file | |
| wget -O /tmp/appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage | |
| chmod +x /tmp/appimagetool | |
| - name: Install Wails | |
| timeout-minutes: 15 | |
| env: | |
| GOFLAGS: "-v" # force verbose output | |
| GOTOOLCHAIN: "local" # prevent auto-upgrade to Go 1.23+ | |
| run: go install -v github.com/wailsapp/wails/v2/cmd/wails@latest | |
| - name: Read version from wails.json | |
| id: version | |
| run: | | |
| v=$(jq -r '.info.productVersion' wails.json) | |
| build="$v.PRE" | |
| echo "version=$build" >> $GITHUB_OUTPUT | |
| - name: Build Wails app | |
| run: | | |
| wails build -clean -ldflags "-X main.Version=${{ steps.version.outputs.version }}" -nsis=false | |
| if [ $? -ne 0 ]; then | |
| echo "Build failed!" | |
| exit 1 | |
| fi | |
| - name: Create AppImage | |
| run: | | |
| # Create AppDir structure | |
| mkdir -p AppDir/usr/bin | |
| mkdir -p AppDir/usr/share/applications | |
| mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps | |
| # Copy binary | |
| cp build/bin/SimpleAI AppDir/usr/bin/SimpleAI | |
| # Copy icon to multiple locations for maximum compatibility | |
| cp build/appicon.png AppDir/usr/share/icons/hicolor/256x256/apps/simpleai.png | |
| cp build/appicon.png AppDir/simpleai.png | |
| cp build/appicon.png AppDir/.DirIcon | |
| # Create desktop file with absolute icon path for AppImage | |
| cat > AppDir/SimpleAI.desktop << 'EOF' | |
| [Desktop Entry] | |
| Version=1.0 | |
| Type=Application | |
| Name=SimpleAI | |
| Comment=Simple frontend for AI chatbots | |
| Exec=SimpleAI | |
| Icon=simpleai | |
| Terminal=false | |
| Categories=Network;Chat; | |
| Keywords=AI;ChatGPT;Claude;Gemini;Copilot; | |
| StartupNotify=true | |
| EOF | |
| # Also copy to standard location | |
| cp AppDir/SimpleAI.desktop AppDir/usr/share/applications/ | |
| # Create AppRun script | |
| cat > AppDir/AppRun << 'EOF' | |
| #!/bin/bash | |
| SELF=$(readlink -f "$0") | |
| HERE=${SELF%/*} | |
| export PATH="${HERE}/usr/bin:${PATH}" | |
| export LD_LIBRARY_PATH="${HERE}/usr/lib:${LD_LIBRARY_PATH}" | |
| exec "${HERE}/usr/bin/SimpleAI" "$@" | |
| EOF | |
| chmod +x AppDir/AppRun | |
| # Build AppImage with proper icon embedding | |
| ARCH=x86_64 /tmp/appimagetool AppDir "build/bin/SimpleAI-${{ steps.version.outputs.version }}.AppImage" | |
| - name: Upload Prerelease AppImage | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: SimpleAI-${{ steps.version.outputs.version }}-linux | |
| path: "build/bin/SimpleAI-${{ steps.version.outputs.version }}.AppImage" | |
| - name: Publish into repo | |
| if: github.ref_type == 'branch' | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| mkdir -p automated-prereleases | |
| cp "build/bin/SimpleAI-${{ steps.version.outputs.version }}.AppImage" "automated-prereleases/" | |
| git add "automated-prereleases/SimpleAI-${{ steps.version.outputs.version }}.AppImage" | |
| git commit -m "Add Linux prerelease ${{ steps.version.outputs.version }}" | |
| git pull --rebase | |
| git push |