name: Build on: push: branches: [main] tags: ["v*"] pull_request: workflow_dispatch: permissions: contents: write env: FLUTTER_VERSION: 3.47.9 defaults: run: shell: bash jobs: windows: runs-on: windows-latest steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: go-version-file: go.mod - uses: subosito/flutter-action@v2 with: channel: stable flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - name: Core run: | go vet ./... go test ./... go build -trimpath -ldflags "-s -w -H=windowsgui" -o dist-core/ymcore.exe ./cmd/ymcore - name: Analyze and test working-directory: app run: | flutter pub get flutter analyze flutter test - name: Build working-directory: app run: | flutter build windows --release cp ../dist-core/ymcore.exe build/windows/x64/runner/Release/ mkdir -p ../dist cp -r build/windows/x64/runner/Release ../dist/YAMD - name: Zip working-directory: dist run: 7z a -tzip YAMD-windows.zip YAMD > /dev/null - uses: actions/upload-artifact@v4 with: name: YAMD-windows path: dist/YAMD - name: Release if: startsWith(github.ref, 'refs/tags/v') uses: softprops/action-gh-release@v2 with: files: dist/YAMD-windows.zip linux: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: go-version-file: go.mod - uses: subosito/flutter-action@v2 with: channel: stable flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - name: System packages run: | sudo apt-get update sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev file desktop-file-utils - name: Core run: | go test ./... CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o dist-core/ymcore ./cmd/ymcore - name: Build working-directory: app run: | flutter pub get flutter build linux --release - name: AppImage run: | bundle=app/build/linux/x64/release/bundle appdir=dist/AppDir mkdir -p "$appdir/usr/bin" cp -r "$bundle/." "$appdir/usr/bin/" cp dist-core/ymcore "$appdir/usr/bin/" cp app/linux/packaging/yamd.png "$appdir/usr/bin/data/yamd.png" cp app/linux/packaging/yamd.desktop "$appdir/yamd.desktop" cp app/linux/packaging/yamd.png "$appdir/yamd.png" cp app/linux/packaging/yamd.png "$appdir/.DirIcon" cat > "$appdir/AppRun" <<'EOF' #!/bin/sh here="$(dirname "$(readlink -f "$0")")" exec "$here/usr/bin/yamd" "$@" EOF sed -i 's/^ *//' "$appdir/AppRun" chmod +x "$appdir/AppRun" "$appdir/usr/bin/yamd" "$appdir/usr/bin/ymcore" wget -q -O appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage chmod +x appimagetool ARCH=x86_64 APPIMAGE_EXTRACT_AND_RUN=1 ./appimagetool "$appdir" dist/YAMD-linux-x86_64.AppImage - uses: actions/upload-artifact@v4 with: name: YAMD-linux path: dist/YAMD-linux-x86_64.AppImage - name: Release if: startsWith(github.ref, 'refs/tags/v') uses: softprops/action-gh-release@v2 with: files: dist/YAMD-linux-x86_64.AppImage macos: runs-on: macos-14 steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: go-version-file: go.mod - uses: subosito/flutter-action@v2 with: channel: stable flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - name: Core run: | go test ./... CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags "-s -w" -o dist-core/ymcore-arm64 ./cmd/ymcore CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags "-s -w" -o dist-core/ymcore-amd64 ./cmd/ymcore lipo -create -output dist-core/ymcore dist-core/ymcore-arm64 dist-core/ymcore-amd64 - name: Build working-directory: app run: | flutter pub get flutter build macos --release - name: DMG run: | app=app/build/macos/Build/Products/Release/YAMD.app cp dist-core/ymcore "$app/Contents/MacOS/ymcore" codesign --force --sign - "$app/Contents/MacOS/ymcore" codesign --force --deep --sign - "$app" mkdir -p dist/dmg cp -R "$app" dist/dmg/ ln -s /Applications dist/dmg/Applications hdiutil create -volname YAMD -srcfolder dist/dmg -ov -format UDZO dist/YAMD-macos.dmg - uses: actions/upload-artifact@v4 with: name: YAMD-macos path: dist/YAMD-macos.dmg - name: Release if: startsWith(github.ref, 'refs/tags/v') uses: softprops/action-gh-release@v2 with: files: dist/YAMD-macos.dmg