diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..fe9d654 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,373 @@ +name: Build & Package + +on: + workflow_dispatch: + push: + branches: + - release + +jobs: + build: + permissions: + contents: read + strategy: + fail-fast: false + matrix: + include: + - platform: ubuntu-22.04 + target: '' + artifact-name: linux-x86_64 + - platform: macos-latest + target: aarch64-apple-darwin + artifact-name: macos-arm64 + - platform: macos-latest + target: x86_64-apple-darwin + artifact-name: macos-x86_64 + - platform: windows-latest + target: '' + artifact-name: windows-x86_64 + + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Clone egui fork + run: git clone --depth 1 -b ibus-wayland-fix https://git.skyler.io/skyler/egui.git ../egui-fork + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} + + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: './lightningbeam-ui -> target' + key: ${{ matrix.target || 'default' }} + + # ── Linux dependencies ── + - name: Install dependencies (Linux) + if: matrix.platform == 'ubuntu-22.04' + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential pkg-config clang nasm cmake \ + libasound2-dev libwayland-dev libwayland-cursor0 \ + libx11-dev libxkbcommon-dev libxcb-shape0-dev libxcb-xfixes0-dev \ + libxdo-dev libglib2.0-dev libgtk-3-dev libvulkan-dev \ + yasm libx264-dev libx265-dev libvpx-dev libmp3lame-dev libopus-dev \ + libpulse-dev squashfs-tools dpkg rpm + + - name: Install cargo packaging tools (Linux) + if: matrix.platform == 'ubuntu-22.04' + uses: taiki-e/install-action@v2 + with: + tool: cargo-deb,cargo-generate-rpm + + # ── macOS dependencies ── + - name: Install dependencies (macOS) + if: matrix.platform == 'macos-latest' + run: brew install nasm cmake create-dmg + + # ── Windows dependencies ── + - name: Install dependencies (Windows) + if: matrix.platform == 'windows-latest' + run: choco install nasm cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y + shell: pwsh + + # ── Common build steps ── + - name: Extract version + id: version + shell: bash + run: | + VERSION=$(grep '^version' lightningbeam-ui/lightningbeam-editor/Cargo.toml | sed 's/.*"\(.*\)"/\1/') + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Enable FFmpeg build from source + shell: bash + run: | + sed -i.bak 's/ffmpeg-next = { version = "8.0", features = \["static"\] }/ffmpeg-next = { version = "8.0", features = ["build", "static"] }/' lightningbeam-ui/lightningbeam-editor/Cargo.toml + + - name: Setup icons + shell: bash + run: | + mkdir -p lightningbeam-ui/lightningbeam-editor/assets/icons + cp -f src-tauri/icons/32x32.png lightningbeam-ui/lightningbeam-editor/assets/icons/ + cp -f src-tauri/icons/128x128.png lightningbeam-ui/lightningbeam-editor/assets/icons/ + cp -f src-tauri/icons/icon.png lightningbeam-ui/lightningbeam-editor/assets/icons/256x256.png + + - name: Stage factory presets + shell: bash + run: | + mkdir -p lightningbeam-ui/lightningbeam-editor/assets/presets + cp -r src/assets/instruments/* lightningbeam-ui/lightningbeam-editor/assets/presets/ + # Remove empty category dirs and README + find lightningbeam-ui/lightningbeam-editor/assets/presets -maxdepth 1 -type d -empty -delete + rm -f lightningbeam-ui/lightningbeam-editor/assets/presets/README.md + + - name: Inject preset entries into RPM metadata (Linux) + if: matrix.platform == 'ubuntu-22.04' + shell: bash + run: | + cd lightningbeam-ui + find lightningbeam-editor/assets/presets -type f | sort | while read -r f; do + rel="${f#lightningbeam-editor/}" + dest="/usr/share/lightningbeam-editor/presets/${f#lightningbeam-editor/assets/presets/}" + printf '\n[[package.metadata.generate-rpm.assets]]\nsource = "%s"\ndest = "%s"\nmode = "644"\n' "$rel" "$dest" >> lightningbeam-editor/Cargo.toml + done + + - name: Build release binary + shell: bash + env: + FFMPEG_STATIC: "1" + run: | + cd lightningbeam-ui + if [ -n "${{ matrix.target }}" ]; then + cargo build --release --bin lightningbeam-editor --target ${{ matrix.target }} + else + cargo build --release --bin lightningbeam-editor + fi + + - name: Copy cross-compiled binary to release dir (macOS cross) + if: matrix.target != '' + shell: bash + run: | + mkdir -p lightningbeam-ui/target/release + cp lightningbeam-ui/target/${{ matrix.target }}/release/lightningbeam-editor lightningbeam-ui/target/release/ + + # ── Stage presets next to binary for packaging ── + - name: Stage presets in target dir + shell: bash + run: | + mkdir -p lightningbeam-ui/target/release/presets + cp -r lightningbeam-ui/lightningbeam-editor/assets/presets/* lightningbeam-ui/target/release/presets/ + + # ══════════════════════════════════════════════ + # Linux Packaging + # ══════════════════════════════════════════════ + - name: Build .deb package + if: matrix.platform == 'ubuntu-22.04' + shell: bash + run: | + cd lightningbeam-ui + cargo deb -p lightningbeam-editor --no-build --no-strip + + # Inject factory presets into .deb (cargo-deb doesn't handle recursive dirs well) + DEB=$(ls target/debian/*.deb | head -1) + WORK=$(mktemp -d) + dpkg-deb -R "$DEB" "$WORK" + mkdir -p "$WORK/usr/share/lightningbeam-editor/presets" + cp -r lightningbeam-editor/assets/presets/* "$WORK/usr/share/lightningbeam-editor/presets/" + dpkg-deb -b "$WORK" "$DEB" + rm -rf "$WORK" + + - name: Build .rpm package + if: matrix.platform == 'ubuntu-22.04' + shell: bash + run: | + cd lightningbeam-ui + cargo generate-rpm -p lightningbeam-editor + + - name: Build AppImage + if: matrix.platform == 'ubuntu-22.04' + shell: bash + run: | + cd lightningbeam-ui + VERSION="${{ steps.version.outputs.version }}" + APPDIR=/tmp/AppDir + ASSETS=lightningbeam-editor/assets + + rm -rf "$APPDIR" + mkdir -p "$APPDIR/usr/bin" + mkdir -p "$APPDIR/usr/bin/presets" + mkdir -p "$APPDIR/usr/share/applications" + mkdir -p "$APPDIR/usr/share/metainfo" + mkdir -p "$APPDIR/usr/share/icons/hicolor/32x32/apps" + mkdir -p "$APPDIR/usr/share/icons/hicolor/128x128/apps" + mkdir -p "$APPDIR/usr/share/icons/hicolor/256x256/apps" + + cp target/release/lightningbeam-editor "$APPDIR/usr/bin/" + cp -r lightningbeam-editor/assets/presets/* "$APPDIR/usr/bin/presets/" + + cp "$ASSETS/com.lightningbeam.editor.desktop" "$APPDIR/usr/share/applications/" + cp "$ASSETS/com.lightningbeam.editor.appdata.xml" "$APPDIR/usr/share/metainfo/" + cp "$ASSETS/icons/32x32.png" "$APPDIR/usr/share/icons/hicolor/32x32/apps/lightningbeam-editor.png" + cp "$ASSETS/icons/128x128.png" "$APPDIR/usr/share/icons/hicolor/128x128/apps/lightningbeam-editor.png" + cp "$ASSETS/icons/256x256.png" "$APPDIR/usr/share/icons/hicolor/256x256/apps/lightningbeam-editor.png" + + ln -sf usr/share/icons/hicolor/256x256/apps/lightningbeam-editor.png "$APPDIR/lightningbeam-editor.png" + ln -sf usr/share/applications/com.lightningbeam.editor.desktop "$APPDIR/lightningbeam-editor.desktop" + + printf '#!/bin/bash\nSELF=$(readlink -f "$0")\nHERE=${SELF%%/*}\nexport XDG_DATA_DIRS="${HERE}/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"\nexec "${HERE}/usr/bin/lightningbeam-editor" "$@"\n' > "$APPDIR/AppRun" + chmod +x "$APPDIR/AppRun" + + # Download AppImage runtime + wget -q "https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-x86_64" \ + -O /tmp/appimage-runtime + chmod +x /tmp/appimage-runtime + + # Build squashfs and concatenate + mksquashfs "$APPDIR" /tmp/appimage.squashfs \ + -root-owned -noappend -no-exports -no-xattrs \ + -comp gzip -b 131072 + cat /tmp/appimage-runtime /tmp/appimage.squashfs \ + > "Lightningbeam_Editor-${VERSION}-x86_64.AppImage" + chmod +x "Lightningbeam_Editor-${VERSION}-x86_64.AppImage" + + - name: Collect Linux artifacts + if: matrix.platform == 'ubuntu-22.04' + shell: bash + run: | + mkdir -p artifacts + cp lightningbeam-ui/target/debian/*.deb artifacts/ + cp lightningbeam-ui/target/generate-rpm/*.rpm artifacts/ + cp lightningbeam-ui/Lightningbeam_Editor-*.AppImage artifacts/ + + # ══════════════════════════════════════════════ + # macOS Packaging + # ══════════════════════════════════════════════ + - name: Create macOS .app bundle + if: matrix.platform == 'macos-latest' + shell: bash + run: | + VERSION="${{ steps.version.outputs.version }}" + APP="Lightningbeam Editor.app" + mkdir -p "$APP/Contents/MacOS" + mkdir -p "$APP/Contents/Resources/presets" + + cp lightningbeam-ui/target/release/lightningbeam-editor "$APP/Contents/MacOS/" + cp src-tauri/icons/icon.icns "$APP/Contents/Resources/lightningbeam-editor.icns" + cp -r lightningbeam-ui/lightningbeam-editor/assets/presets/* "$APP/Contents/Resources/presets/" + + cat > "$APP/Contents/Info.plist" << EOF + + + + + CFBundleName + Lightningbeam Editor + CFBundleDisplayName + Lightningbeam Editor + CFBundleIdentifier + com.lightningbeam.editor + CFBundleVersion + ${VERSION} + CFBundleShortVersionString + ${VERSION} + CFBundlePackageType + APPL + CFBundleExecutable + lightningbeam-editor + CFBundleIconFile + lightningbeam-editor + LSMinimumSystemVersion + 11.0 + NSHighResolutionCapable + + + + EOF + + - name: Create macOS .dmg + if: matrix.platform == 'macos-latest' + shell: bash + run: | + VERSION="${{ steps.version.outputs.version }}" + ARCH="${{ matrix.target == 'aarch64-apple-darwin' && 'arm64' || 'x86_64' }}" + DMG_NAME="Lightningbeam_Editor-${VERSION}-macOS-${ARCH}.dmg" + + create-dmg \ + --volname "Lightningbeam Editor" \ + --window-pos 200 120 \ + --window-size 600 400 \ + --icon-size 100 \ + --icon "Lightningbeam Editor.app" 175 190 \ + --app-drop-link 425 190 \ + "$DMG_NAME" \ + "Lightningbeam Editor.app" || true + # create-dmg returns non-zero if codesigning is skipped, but the .dmg is still valid + + - name: Collect macOS artifacts + if: matrix.platform == 'macos-latest' + shell: bash + run: | + mkdir -p artifacts + cp Lightningbeam_Editor-*.dmg artifacts/ + + # ══════════════════════════════════════════════ + # Windows Packaging + # ══════════════════════════════════════════════ + - name: Create Windows .zip + if: matrix.platform == 'windows-latest' + shell: pwsh + run: | + $VERSION = "${{ steps.version.outputs.version }}" + $DIST = "Lightningbeam_Editor-${VERSION}-Windows-x86_64" + New-Item -ItemType Directory -Force -Path $DIST + Copy-Item "lightningbeam-ui/target/release/lightningbeam-editor.exe" "$DIST/" + Copy-Item -Recurse "lightningbeam-ui/target/release/presets" "$DIST/presets" + Compress-Archive -Path $DIST -DestinationPath "${DIST}.zip" + + - name: Collect Windows artifacts + if: matrix.platform == 'windows-latest' + shell: pwsh + run: | + New-Item -ItemType Directory -Force -Path artifacts + Copy-Item "Lightningbeam_Editor-*.zip" "artifacts/" + + # ── Upload ── + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact-name }} + path: artifacts/* + if-no-files-found: error + + release: + needs: build + runs-on: ubuntu-22.04 + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: | + lightningbeam-ui/lightningbeam-editor/Cargo.toml + Changelog.md + + - name: Extract version + id: version + run: | + VERSION=$(grep '^version' lightningbeam-ui/lightningbeam-editor/Cargo.toml | sed 's/.*"\(.*\)"/\1/') + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Extract release notes + id: notes + uses: sean0x42/markdown-extract@v2.1.0 + with: + pattern: "${{ steps.version.outputs.version }}:" + file: Changelog.md + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + + - name: List artifacts + run: ls -lhR dist/ + + - name: Create draft release + uses: softprops/action-gh-release@v2 + with: + tag_name: "v${{ steps.version.outputs.version }}" + name: "Lightningbeam v${{ steps.version.outputs.version }}" + body: ${{ steps.notes.outputs.markdown }} + draft: true + prerelease: true + files: dist/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 657ee38..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,150 +0,0 @@ -name: 'publish' - -on: - workflow_dispatch: - push: - branches: - - release - -jobs: - extract-changelog: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - - name: Set version for changelog extraction - shell: bash - run: | - # Read the version from src-tauri/tauri.conf.json - VERSION=$(jq -r '.version' src-tauri/tauri.conf.json) - # Set the version in the environment variable - echo "VERSION=$VERSION" >> $GITHUB_ENV - - - name: Extract release notes from Changelog.md - id: changelog - uses: sean0x42/markdown-extract@v2.1.0 - with: - pattern: "${{ env.VERSION }}:" # Look for the version header (e.g., # 0.6.15-alpha:) - file: Changelog.md - - - name: Set markdown output - id: set-markdown-output - run: | - echo 'RELEASE_NOTES<> $GITHUB_OUTPUT - echo "${{ steps.changelog.outputs.markdown }}" >> $GITHUB_OUTPUT - echo 'EOF' >> $GITHUB_OUTPUT - - publish-tauri: - needs: extract-changelog - permissions: - contents: write - strategy: - fail-fast: false - matrix: - include: - - platform: 'macos-latest' # for Arm based macs (M1 and above). - args: '--target aarch64-apple-darwin' - - platform: 'macos-latest' # for Intel based macs. - args: '--target x86_64-apple-darwin' - - platform: 'ubuntu-22.04' - args: '' - - platform: 'windows-latest' - args: '' - - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@v4 - - - name: Debug the extracted release notes - run: | - echo "Extracted Release Notes: ${{ needs.extract-changelog.outputs.RELEASE_NOTES }}" - - - name: install dependencies (ubuntu only) - if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above. - run: | - sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf - - - name: Install jq on Windows - if: matrix.platform == 'windows-latest' - run: | - choco install jq - - - name: Set version for all platforms - shell: bash - run: | - # Read the version from src-tauri/tauri.conf.json - VERSION=$(jq -r '.version' src-tauri/tauri.conf.json) - # Set the version in the environment variable - echo "VERSION=$VERSION" >> $GITHUB_ENV - if: matrix.platform != 'windows-latest' - - - name: Set version for Windows build - if: matrix.platform == 'windows-latest' # Only run on Windows - shell: pwsh # Use PowerShell on Windows runners - run: | - # Read the version from src-tauri/tauri.conf.json - $tauriConf = Get-Content src-tauri/tauri.conf.json | ConvertFrom-Json - $VERSION = $tauriConf.version - - # Replace '-alpha' with '-0' and '-beta' with '-1' for Windows version - if ($VERSION -match "-alpha") { - $WINDOWS_VERSION = $VERSION -replace "-alpha", "-1" - } elseif ($VERSION -match "-beta") { - $WINDOWS_VERSION = $VERSION -replace "-beta", "-2" - } else { - $WINDOWS_VERSION = $VERSION - } - Copy-Item src-tauri/tauri.conf.json -Destination src-tauri/tauri.windows.conf.json - - # Modify the version in tauri.windows.conf.json - (Get-Content src-tauri/tauri.windows.conf.json) | ForEach-Object { - $_ -replace '"version": ".*"', ('"version": "' + $WINDOWS_VERSION + '"') - } | Set-Content src-tauri/tauri.windows.conf.json - - echo "VERSION=$VERSION" >> $env:GITHUB_ENV - - - name: Print contents of tauri.windows.conf.json (Windows) - if: matrix.platform == 'windows-latest' # Only run on Windows - shell: pwsh - run: | - Write-Host "Contents of src-tauri/tauri.windows.conf.json:" - Get-Content src-tauri/tauri.windows.conf.json - - - name: setup pnpm - uses: pnpm/action-setup@v2 - with: - version: 9.1.2 - - name: setup node - uses: actions/setup-node@v4 - with: - node-version: lts/* - cache: 'pnpm' # Set this to npm, yarn or pnpm. - - - name: install Rust stable - uses: dtolnay/rust-toolchain@stable # Set this to dtolnay/rust-toolchain@nightly - with: - # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. - targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} - - - name: Rust cache - uses: swatinem/rust-cache@v2 - with: - workspaces: './src-tauri -> target' - - - name: install frontend dependencies - # If you don't have `beforeBuildCommand` configured you may want to build your frontend here too. - run: pnpm install # change this to npm or pnpm depending on which one you use. - - - name: Create Release with Tauri Action - uses: tauri-apps/tauri-action@v0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RELEASE_NOTES: ${{ needs.extract-changelog.outputs.RELEASE_NOTES }} - with: - tagName: "app-v${{ env.VERSION }}" # Use the original version tag for the release - releaseName: "Lightningbeam v${{ env.VERSION }}" - releaseBody: "${{ needs.extract-changelog.outputs.RELEASE_NOTES }}" - releaseDraft: true # Set to true if you want the release to be a draft - prerelease: true - args: ${{ matrix.args }} diff --git a/Changelog.md b/Changelog.md index 1415c48..b335e30 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,11 @@ +# 1.0.0-alpha: +Changes: +- New native GUI built with egui + wgpu (replaces Tauri/web frontend) +- GPU-accelerated canvas with vello rendering +- MIDI input and node-based audio graph improvements +- Factory instrument presets +- Video import and high performance playback + # 0.8.1-alpha: Changes: - Rewrite timeline UI diff --git a/lightningbeam-ui/lightningbeam-editor/Cargo.toml b/lightningbeam-ui/lightningbeam-editor/Cargo.toml index d03b24d..4d9f2df 100644 --- a/lightningbeam-ui/lightningbeam-editor/Cargo.toml +++ b/lightningbeam-ui/lightningbeam-editor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lightningbeam-editor" -version = "0.1.0" +version = "2.0.0-alpha" edition = "2021" description = "Multimedia editor for audio, video and 2D animation" license = "GPL-3.0-or-later"