feat: Add Windows portable build with true portable mode #20
Workflow file for this run
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
| # Release workflow - builds and publishes when a version tag is pushed | |
| # Usage: git tag v0.1.0 && git push --tags | |
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build-windows: | |
| name: Build Windows | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build release | |
| run: cargo build --release | |
| - name: Create portable release archive | |
| shell: pwsh | |
| run: | | |
| mkdir release | |
| copy target\release\ferrite.exe release\ | |
| mkdir release\portable | |
| $readme = @( | |
| "Ferrite - Portable Edition" | |
| "===========================" | |
| "" | |
| "This is the portable version of Ferrite. All your settings," | |
| "sessions, and data will be stored in the 'portable' folder" | |
| "next to ferrite.exe." | |
| "" | |
| "To use:" | |
| "1. Extract this folder anywhere (USB drive, local folder, etc.)" | |
| "2. Run ferrite.exe" | |
| "3. Your configuration will be saved in the 'portable' subfolder" | |
| "" | |
| "This version does not modify your system - perfect for USB drives" | |
| "or trying Ferrite without installation." | |
| "" | |
| "For a traditional Windows installation, use the .msi installer instead." | |
| "" | |
| "Website: https://ferrite.ink" | |
| ) -join "`r`n" | |
| Set-Content -Path release\README.txt -Value $readme -NoNewline | |
| Compress-Archive -Path release\* -DestinationPath ferrite-portable-windows-x64.zip | |
| - name: Install cargo-wix | |
| run: cargo install cargo-wix | |
| - name: Build MSI installer | |
| run: cargo wix --no-build --nocapture | |
| - name: Copy MSI to workspace root | |
| run: copy target\wix\*.msi .\ferrite-windows-x64.msi | |
| - name: Upload portable zip artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ferrite-portable-windows-x64 | |
| path: ferrite-portable-windows-x64.zip | |
| - name: Upload MSI artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ferrite-windows-msi | |
| path: ferrite-windows-x64.msi | |
| build-linux: | |
| name: Build Linux | |
| runs-on: ubuntu-22.04 # Use 22.04 for wider glibc compatibility | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libxcb-shape0-dev libxcb-xfixes0-dev | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install cargo-deb and cargo-generate-rpm | |
| run: | | |
| cargo install cargo-deb | |
| cargo install cargo-generate-rpm | |
| - name: Build release | |
| run: cargo build --release | |
| - name: Create release archive | |
| run: | | |
| mkdir release | |
| cp target/release/ferrite release/ | |
| tar -czvf ferrite-linux-x64.tar.gz -C release . | |
| - name: Build .deb package (Debian/Ubuntu) | |
| run: cargo deb --no-build | |
| - name: Build .rpm package (Fedora/RHEL) | |
| run: cargo generate-rpm | |
| - name: Copy packages to workspace root | |
| run: | | |
| cp target/debian/*.deb ./ferrite-editor_amd64.deb | |
| cp target/generate-rpm/*.rpm ./ferrite-editor.x86_64.rpm | |
| - name: Upload tar.gz artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ferrite-linux-x64 | |
| path: ferrite-linux-x64.tar.gz | |
| - name: Upload .deb artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ferrite-linux-deb | |
| path: ferrite-editor_amd64.deb | |
| - name: Upload .rpm artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ferrite-linux-rpm | |
| path: ferrite-editor.x86_64.rpm | |
| build-macos-arm64: | |
| name: Build macOS (Apple Silicon) | |
| runs-on: macos-latest # macos-latest is ARM64 (Apple Silicon) | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Generate macOS .icns icon | |
| run: | | |
| if [ -d "assets/icons/macos/app.iconset" ]; then | |
| iconutil -c icns assets/icons/macos/app.iconset -o assets/icons/macos/app.icns | |
| echo "Generated app.icns" | |
| else | |
| echo "Warning: app.iconset not found, skipping .icns generation" | |
| fi | |
| - name: Build release | |
| run: cargo build --release | |
| - name: Create release archive | |
| run: | | |
| mkdir release | |
| cp target/release/ferrite release/ | |
| tar -czvf ferrite-macos-arm64.tar.gz -C release . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ferrite-macos-arm64 | |
| path: ferrite-macos-arm64.tar.gz | |
| build-macos-intel: | |
| name: Build macOS (Intel) | |
| runs-on: macos-14 # Cross-compile to x86_64 from ARM64 runner | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust with Intel target | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-apple-darwin | |
| - name: Build release for Intel | |
| run: cargo build --release --target x86_64-apple-darwin | |
| - name: Create release archive | |
| run: | | |
| mkdir release | |
| cp target/x86_64-apple-darwin/release/ferrite release/ | |
| tar -czvf ferrite-macos-x64.tar.gz -C release . | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ferrite-macos-x64 | |
| path: ferrite-macos-x64.tar.gz | |
| # NOTE: musl static build disabled - GUI apps with font rendering (freetype, fontconfig) | |
| # and graphics (X11/Wayland) dependencies cannot be easily built as static musl binaries. | |
| # The glibc build (Ubuntu 22.04) provides good compatibility across Linux distributions. | |
| # Create GitHub Release with all artifacts | |
| release: | |
| name: Create Release | |
| needs: [build-windows, build-linux, build-macos-arm64, build-macos-intel] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download Windows portable zip artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ferrite-portable-windows-x64 | |
| - name: Download Windows MSI artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ferrite-windows-msi | |
| - name: Download Linux artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ferrite-linux-x64 | |
| - name: Download Linux .deb artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ferrite-linux-deb | |
| - name: Download Linux .rpm artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ferrite-linux-rpm | |
| - name: Download macOS ARM64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ferrite-macos-arm64 | |
| - name: Download macOS Intel artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ferrite-macos-x64 | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: Ferrite ${{ github.ref_name }} | |
| draft: false | |
| prerelease: ${{ contains(github.ref_name, '-') }} | |
| generate_release_notes: true | |
| files: | | |
| ferrite-portable-windows-x64.zip | |
| ferrite-windows-x64.msi | |
| ferrite-linux-x64.tar.gz | |
| ferrite-editor_amd64.deb | |
| ferrite-editor.x86_64.rpm | |
| ferrite-macos-arm64.tar.gz | |
| ferrite-macos-x64.tar.gz |