diff --git a/.github/workflows/local/release_main.yml b/.github/workflows/local/release_main.yml new file mode 100644 index 00000000..239d69ff --- /dev/null +++ b/.github/workflows/local/release_main.yml @@ -0,0 +1,218 @@ +name: Release on main (local act test) + +on: + push: + branches: [ main ] + +permissions: + contents: write + +jobs: + build-android-apk: + name: Build Android APK (debug) + runs-on: ubuntu-latest + steps: + - name: Checkout du code + uses: actions/checkout@v4 + + - name: Installation de Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Configuration du JDK + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '21' + + - name: Configuration du SDK Android + uses: android-actions/setup-android@v3 + with: + accept-android-sdk-licenses: true + packages: 'platform-tools' # le paquet legacy "tools" n'existe plus dans le repo Google (cf android-actions/setup-android#537) + + - name: Génération des fichiers .env + run: | + echo "${{ secrets.ENV_PRODUCTION }}" > .env.production + echo "${{ secrets.ENV_PRODUCTION }}" > .env + + - name: Installation des dépendances + run: bun install + + - name: Build des assets web + env: + NODE_OPTIONS: --max-old-space-size=6144 + run: bun run build + + - name: Synchronisation Capacitor Android + run: npx cap sync android + + - name: Build de l'APK debug (non signé) + working-directory: android + run: | + sed -i 's/\r$//' gradlew + chmod +x gradlew + sed -i '/org.gradle.java.home/d' gradle.properties # ignore un org.gradle.java.home local (chemin Windows non portable en CI) + ./gradlew assembleDebug + + - name: Upload de l'APK + uses: actions/upload-artifact@v4 + with: + name: synco-android-debug-apk + path: android/app/build/outputs/apk/debug/app-debug.apk + if-no-files-found: error + retention-days: 1 # additional safety for artifact retention + + build-windows-msi: + name: Build de l'installeur Windows (MSI) + runs-on: windows-latest + steps: + - name: Checkout du code + uses: actions/checkout@v4 + + - name: Installation de Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Installation des dépendances + shell: powershell + run: bun install + + - name: Build de l'installeur MSI + shell: powershell + env: + NODE_OPTIONS: --max-old-space-size=6144 + run: bunx tauri build --bundles msi + + - name: Upload du MSI + uses: actions/upload-artifact@v4 + with: + name: synco-windows-msi + path: src-tauri/target/release/bundle/msi/*.msi + if-no-files-found: error + retention-days: 1 # additional safety for artifact retention + + build-linux-appimage: + name: Build de l'AppImage Linux + runs-on: ubuntu-latest + steps: + - name: Checkout du code + uses: actions/checkout@v4 + + - name: Installation de Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Installation de Rust + uses: dtolnay/rust-toolchain@stable + + - name: Installation des dépendances système Tauri (Linux) + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev libjavascriptcoregtk-4.1-dev \ + build-essential curl wget file libxdo-dev libssl-dev patchelf \ + libayatana-appindicator3-dev librsvg2-dev desktop-file-utils \ + gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad gstreamer1.0-libav \ + xdg-utils shared-mime-info + + - name: Génération des fichiers .env + run: | + echo "${{ secrets.ENV_PRODUCTION }}" > .env.production + echo "${{ secrets.ENV_PRODUCTION }}" > .env + + - name: Installation des dépendances + run: bun install + + - name: Build de l'AppImage + env: + NODE_OPTIONS: --max-old-space-size=6144 + APPIMAGE_EXTRACT_AND_RUN: "1" # linuxdeploy a besoin de FUSE, absent des runners/conteneurs ubuntu-24.04+ + NO_STRIP: "true" # le strip des binutils récents (ubuntu-24.04+) plante sur la section .relr.dyn de certaines libs (cf tauri-apps/tauri#15106) + run: bun run tauri:build -- --bundles appimage + + - name: Retrait de libwayland-client bundlée (EGL_BAD_PARAMETER sur Mesa 25+, cf tauri-apps/tauri#15665) + run: | + cd src-tauri/target/release/bundle/appimage + APPIMAGE=$(ls *.AppImage) + chmod +x "$APPIMAGE" + ./"$APPIMAGE" --appimage-extract + rm -f squashfs-root/usr/lib/libwayland-client.so.0 + curl -sL -o appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage + chmod +x appimagetool + ./appimagetool --appimage-extract-and-run squashfs-root "$APPIMAGE" + rm -rf squashfs-root appimagetool + + - name: Upload de l'AppImage + uses: actions/upload-artifact@v4 + with: + name: synco-linux-appimage + path: src-tauri/target/release/bundle/appimage/*.AppImage + if-no-files-found: error + retention-days: 1 # additional safety for artifact retention + + build-docker-image: + name: Build et push de l'image Docker (front, prod) + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout du code + uses: actions/checkout@v4 + + - name: Owner du repo en minuscule (requis par GHCR) + id: meta + run: echo "owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" + + - name: Connexion à GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extraction des VITE_* depuis le secret ENV_PRODUCTION (build args) + id: env + run: | + echo "${{ secrets.ENV_PRODUCTION }}" > /tmp/env.production + { + echo "args<> "$GITHUB_OUTPUT" + + - name: Build et push de l'image prod + uses: docker/build-push-action@v6 + with: + context: . + target: prod + push: true + build-args: ${{ steps.env.outputs.args }} + tags: | + ghcr.io/${{ steps.meta.outputs.owner }}/synco_app:latest + ghcr.io/${{ steps.meta.outputs.owner }}/synco_app:${{ github.sha }} + + create-release: + name: Création de la release GitHub + needs: [ build-android-apk, build-windows-msi, build-linux-appimage ] + runs-on: ubuntu-latest + steps: + - name: Téléchargement des artefacts + uses: actions/download-artifact@v4 + with: + pattern: synco-* + path: release-assets + merge-multiple: true + + - name: Création de la release + uses: softprops/action-gh-release@v2 + with: + tag_name: dev-${{ github.run_number }} + name: "Synco dev build #${{ github.run_number }}" + prerelease: true + generate_release_notes: true + files: release-assets/** diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index 6a3b6d76..d862dc96 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -71,22 +71,15 @@ jobs: with: bun-version: latest - - name: Installation de Rust - uses: dtolnay/rust-toolchain@stable - - - name: Génération des fichiers .env - shell: bash - run: | - echo "${{ secrets.ENV_PRODUCTION }}" > .env.production - echo "${{ secrets.ENV_PRODUCTION }}" > .env - - name: Installation des dépendances + shell: powershell run: bun install - name: Build de l'installeur MSI + shell: powershell env: NODE_OPTIONS: --max-old-space-size=6144 - run: bun run tauri:build -- --bundles msi + run: bunx tauri build --bundles msi - name: Upload du MSI uses: actions/upload-artifact@v4 @@ -118,7 +111,8 @@ jobs: build-essential curl wget file libxdo-dev libssl-dev \ libayatana-appindicator3-dev librsvg2-dev desktop-file-utils \ gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ - gstreamer1.0-plugins-bad gstreamer1.0-libav + gstreamer1.0-plugins-bad gstreamer1.0-libav \ + xdg-utils shared-mime-info - name: Génération des fichiers .env run: | diff --git a/.gitignore b/.gitignore index acceafe8..f68097b4 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,9 @@ dist-ssr *.sw? /.vite .env +.env.prod +.secrets +.env.latest .env.production \n# Local AI Models\npublic/models\n /public/models diff --git a/src-tauri/linux/main.desktop.hbs b/src-tauri/linux/main.desktop.hbs new file mode 100644 index 00000000..063c11cf --- /dev/null +++ b/src-tauri/linux/main.desktop.hbs @@ -0,0 +1,14 @@ +[Desktop Entry] +Categories={{categories}} +{{#if comment}} +Comment={{comment}} +{{/if}} +Exec={{exec}} %u +StartupWMClass={{exec}} +Icon={{icon}} +Name={{name}} +Terminal=false +Type=Application +{{#if mime_type}} +MimeType={{mime_type}} +{{/if}} diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 77f9bbd1..5727a312 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -48,6 +48,12 @@ "linux": { "appimage": { "bundleMediaFramework": true + }, + "deb": { + "desktopTemplate": "linux/main.desktop.hbs" + }, + "rpm": { + "desktopTemplate": "linux/main.desktop.hbs" } } }