diff --git a/.github/workflows/tauri-build.yml b/.github/workflows/tauri-build.yml index 02ce2c04f..ad872e675 100644 --- a/.github/workflows/tauri-build.yml +++ b/.github/workflows/tauri-build.yml @@ -581,7 +581,6 @@ jobs: VERSION: ${{ needs.setup-release.outputs.version }} VITE_APP_VERSION: ${{ needs.setup-release.outputs.version }} SABLE_BUILD_FLAVOR: ${{ needs.setup-release.outputs.nightly == 'true' && 'dev' || 'stable' }} - SABLE_PRODUCT_NAME: ${{ needs.setup-release.outputs.product_name }} REPO: ${{ github.repository }} STARTED_AT: ${{ needs.setup-release.outputs.started_at }} steps: @@ -683,8 +682,6 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ needs.setup-release.outputs.ref }} - # GoReleaser reads the version from git history. - fetch-depth: 0 persist-credentials: false - name: Setup app @@ -703,42 +700,26 @@ jobs: UPDATER_ENDPOINT: ${{ needs.setup-release.outputs.nightly == 'true' && format('https://github.com/{0}/releases/download/nightly/latest.json', github.repository) || '' }} run: node .github/scripts/set-tauri-version.mjs "$VERSION" "$UPDATER_ENDPOINT" - # Not in [bootstrap.packages]: snapcraft ships only as a snap. - - name: Install snapcraft - if: ${{ needs.setup-release.outputs.nightly != 'true' }} - run: sudo snap install snapcraft --classic - - - name: Trust the AUR host key - if: ${{ needs.setup-release.outputs.nightly != 'true' }} - run: | - mkdir -p ~/.ssh - ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts - - - name: Resolve GoReleaser args - id: gr + - name: Build and package Linux bundles shell: bash run: | - if [ "$IS_NIGHTLY" = "true" ]; then - echo 'args=release --clean --snapshot --skip=snapcraft,aur' >> "$GITHUB_OUTPUT" - else - echo 'args=release --clean' >> "$GITHUB_OUTPUT" - fi + pnpm tauri:cef build + ! strings src-tauri/target/release/sable | grep -F 'http://localhost:8080' - - name: Run GoReleaser - shell: bash - env: - GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN || github.token }} - AUR_KEY: ${{ secrets.AUR_KEY }} - SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} - run: goreleaser ${{ steps.gr.outputs.args }} - - - name: Build the AppImage - shell: bash - run: | DISPLAY_NAME=Sable [ "$IS_NIGHTLY" = "true" ] && DISPLAY_NAME="Sable Nightly" mise run cef:package "$VERSION" \ - src-tauri/target/x86_64-unknown-linux-gnu/release/sable "$DISPLAY_NAME" + src-tauri/target/release/sable "$DISPLAY_NAME" + + RELEASE_DIR="src-tauri/target/release/cef-pkg/release" + mkdir -p "$RELEASE_DIR" + cp src-tauri/target/release/sable "$RELEASE_DIR/sable" + cp -a src-tauri/target/release/cef-pkg/stage/runtime \ + src-tauri/target/release/cef-pkg/stage/share "$RELEASE_DIR/" + test -f "$RELEASE_DIR/runtime/CEF-LICENSE.txt" + tar -C "$RELEASE_DIR" -czf \ + "src-tauri/target/release/bundle/Sable-${VERSION}-linux-x86_64.tar.gz" \ + sable runtime share - name: Sign the AppImage for the updater if: ${{ env.TAURI_SIGNING_PRIVATE_KEY != '' }} @@ -753,9 +734,9 @@ jobs: uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1 with: subject-path: | - .goreleaser-dist/*.deb - .goreleaser-dist/*.rpm - .goreleaser-dist/*.pkg.tar.zst + src-tauri/target/release/bundle/deb/*.deb + src-tauri/target/release/bundle/rpm/*.rpm + src-tauri/target/release/bundle/*.tar.gz src-tauri/target/release/bundle/appimage/*.AppImage src-tauri/target/release/bundle/appimage/*.sig @@ -764,10 +745,9 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - for f in .goreleaser-dist/Sable-*.deb \ - .goreleaser-dist/Sable-*.rpm \ - .goreleaser-dist/Sable-*.pkg.tar.zst \ - .goreleaser-dist/Sable-*-linux-x86_64.tar.gz \ + for f in src-tauri/target/release/bundle/deb/Sable-*.deb \ + src-tauri/target/release/bundle/rpm/Sable-*.rpm \ + src-tauri/target/release/bundle/Sable-*-linux-x86_64.tar.gz \ src-tauri/target/release/bundle/appimage/Sable-*-linux-x86_64.AppImage \ src-tauri/target/release/bundle/appimage/Sable-*-linux-x86_64.AppImage.sig; do [ -e "$f" ] || continue @@ -779,10 +759,10 @@ jobs: uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: sable-linux-deb - path: .goreleaser-dist/Sable-*.deb + path: src-tauri/target/release/bundle/deb/Sable-*.deb + if-no-files-found: error retention-days: 1 include-hidden-files: true - if-no-files-found: error distribute-nightly-aur: name: Publish nightly to AUR @@ -885,9 +865,6 @@ jobs: distribute-homebrew: name: Publish Homebrew cask - # GoReleaser's homebrew_casks pipe would build the cask from our Linux - # archive, since it is the only one it produces. Tauri owns the .dmg and - # importing it needs the Pro-only `prebuilt` builder. needs: [setup-release, build] runs-on: ubuntu-latest timeout-minutes: 10 diff --git a/.goreleaser.yaml b/.goreleaser.yaml deleted file mode 100644 index 34d8b0cdb..000000000 --- a/.goreleaser.yaml +++ /dev/null @@ -1,204 +0,0 @@ -# yaml-language-server: $schema=https://goreleaser.com/static/schema.json -# Linux packaging for the CEF build. Tauri builds the macOS/Windows bundles; -# GoReleaser OSS can't import pre-built artifacts (`builder: prebuilt` is Pro). -# -# Secrets: AUR_KEY, SNAPCRAFT_STORE_CREDENTIALS - -version: 2 - -project_name: sable - -# Vite owns ./dist. -dist: .goreleaser-dist - -before: - hooks: - - pnpm install --frozen-lockfile - # cargo skips tauri.conf.json's beforeBuildCommand. - - pnpm build - -builds: - - id: sable - builder: rust - dir: src-tauri - tool: cargo - command: build - targets: [x86_64-unknown-linux-gnu] - flags: - - --release - - --no-default-features - - --features - - cef,updater - hooks: - post: bash scripts/cef/stage.sh - -archives: - - id: sable - formats: [tar.gz] - name_template: 'Sable-{{ .Version }}-linux-x86_64' - files: - - LICENSE - - src: src-tauri/target/cef-stage/runtime - dst: . - - src: src-tauri/target/cef-stage/share - dst: . - -nfpms: - - package_name: sable - file_name_template: 'Sable-{{ .Version }}-linux-x86_64' - homepage: https://sable.moe - maintainer: Sable Maintainers - description: Sable, a Matrix client - license: AGPL-3.0-or-later - section: net - formats: [deb, rpm, archlinux] - # Beside the CEF runtime, for build.rs's rpath=$ORIGIN. - bindir: /opt/sable - provides: [sable] - contents: - - src: src-tauri/target/cef-stage/runtime/ - dst: /opt/sable - type: tree - - src: src-tauri/target/cef-stage/share/ - dst: /usr/share - type: tree - - src: /opt/sable/sable - dst: /usr/bin/sable - type: symlink - scripts: - postinstall: packaging/linux/postinstall.sh - postremove: packaging/linux/postinstall.sh - overrides: - deb: - dependencies: - - libgtk-3-0 - - libnss3 - - libnspr4 - - libgbm1 - - libdrm2 - - libxkbcommon0 - - libxss1 - - libasound2 - - libcups2 - - xdg-utils - - libayatana-appindicator3-1 - rpm: - dependencies: - - gtk3 - - nss - - nspr - - mesa-libgbm - - libdrm - - libxkbcommon - - libXScrnSaver - - alsa-lib - - cups-libs - - xdg-utils - - libayatana-appindicator3.so.1()(64bit) - archlinux: - dependencies: - - gtk3 - - nss - - alsa-lib - - libcups - - libdrm - - mesa - - libxkbcommon - - libxss - - at-spi2-core - - dbus - - xdg-utils - - libayatana-appindicator - - hicolor-icon-theme - - desktop-file-utils - -aurs: - - name: sable-bin - homepage: https://sable.moe - description: Sable, a Matrix client - maintainers: - - Sable Maintainers - license: AGPL-3.0-or-later - private_key: '{{ .Env.AUR_KEY }}' - git_url: ssh://aur@aur.archlinux.org/sable-bin.git - provides: [sable] - conflicts: [sable, sable-nightly-bin] - depends: - - gtk3 - - nss - - alsa-lib - - libcups - - libdrm - - mesa - - libxkbcommon - - libxss - - at-spi2-core - - dbus - - xdg-utils - - libayatana-appindicator - - hicolor-icon-theme - - desktop-file-utils - package: |- - install -Dm755 sable "${pkgdir}/opt/sable/sable" - cp -a runtime/. "${pkgdir}/opt/sable/" - install -dm755 "${pkgdir}/usr/share" "${pkgdir}/usr/bin" - cp -a share/. "${pkgdir}/usr/share/" - ln -s /opt/sable/sable "${pkgdir}/usr/bin/sable" - install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" - commit_author: - name: github-actions[bot] - email: github-actions[bot]@users.noreply.github.com - -snapcrafts: - - name: sable - title: Sable - summary: Sable, a Matrix client - description: | - Sable is a cross-platform Matrix client built with Tauri, offering a - native desktop experience with end-to-end encryption support. - icon: src-tauri/icons/128x128@2x.png - license: AGPL-3.0-or-later - grade: stable - confinement: strict - base: core22 - publish: true - extra_files: - # Binaries land at the prime root. - - source: src-tauri/target/cef-stage/runtime - destination: . - - source: src-tauri/target/cef-stage/share/applications/sable.desktop - destination: meta/gui/sable.desktop - - source: src-tauri/icons/128x128@2x.png - destination: meta/gui/icon.png - apps: - sable: - command: sable - desktop: meta/gui/sable.desktop - extensions: [gnome] - plugs: - - network - - network-bind - - home - - removable-media - - browser-support - - audio-playback - - audio-record - - camera - - password-manager-service - -checksum: - name_template: 'Sable-{{ .Version }}-linux-checksums.txt' - algorithm: sha256 - -# Nightlies run `release --snapshot`; GoReleaser's `nightly` pipe is Pro-only. -snapshot: - version_template: '{{ .Env.VERSION }}' - -release: - github: - owner: SableClient - name: Sable - # Knope writes the release notes. - mode: keep-existing - draft: false - prerelease: auto diff --git a/README.md b/README.md index 629d4c209..39c5d101e 100644 --- a/README.md +++ b/README.md @@ -17,10 +17,6 @@ You can also download our desktop app for Windows and Linux from [releases](http Download   -AUR -  -Snap Store -  Flathub On macOS, via our [Homebrew tap](https://github.com/SableClient/homebrew-sable): diff --git a/mise.tauri.toml b/mise.tauri.toml index e738b15c0..33ba8a4c4 100644 --- a/mise.tauri.toml +++ b/mise.tauri.toml @@ -12,7 +12,8 @@ experimental = true # Android java = "temurin-21" android-sdk = "22.0" -goreleaser = "2.17.0" +actionlint = "1.7.10" +"aqua:goreleaser/nfpm" = "2.47.0" [bootstrap.packages] # Debian/Ubuntu diff --git a/nfpm.yaml b/nfpm.yaml new file mode 100644 index 000000000..e6b78751e --- /dev/null +++ b/nfpm.yaml @@ -0,0 +1,50 @@ +# yaml-language-server: $schema=https://nfpm.goreleaser.com/schema.json + +name: sable +arch: amd64 +platform: linux +version: ${PKG_VERSION} +release: ${PKG_RELEASE} +version_schema: semver +section: net +maintainer: SableClient +description: Sable, a Matrix client +homepage: https://sable.moe + +contents: + - src: ${PKGROOT}/opt/sable/ + dst: /opt/sable + type: tree + expand: true + - src: ${PKGROOT}/usr/ + dst: /usr + type: tree + expand: true + +overrides: + deb: + depends: + - libgtk-3-0 + - libnss3 + - libnspr4 + - libgbm1 + - libdrm2 + - libxkbcommon0 + - libasound2 + - libcups2 + - xdg-utils + - xwayland + - libayatana-appindicator3-1 + rpm: + depends: + - gtk3 + - nss + - nspr + - mesa-libgbm + - libdrm + - libxkbcommon + - alsa-lib + - cups-libs + - xdg-utils + - xorg-x11-server-Xwayland + - libayatana-appindicator3.so.1()(64bit) diff --git a/scripts/cef/copy-libs.sh b/scripts/cef/copy-libs.sh index c32b72615..3c5ca4bee 100755 --- a/scripts/cef/copy-libs.sh +++ b/scripts/cef/copy-libs.sh @@ -63,6 +63,10 @@ cp -f "$CEF_DIR"/*.so* "$DEST/" 2>/dev/null || true cp -f "$CEF_DIR"/chrome_crashpad_handler "$DEST/" 2>/dev/null || true cp -f "$CEF_DIR"/*.pak "$CEF_DIR"/*.dat "$CEF_DIR"/*.bin "$CEF_DIR"/*.json "$DEST/" 2>/dev/null || true +# CEF's BSD license must accompany binary redistributions. Keep its original +# text beside the runtime so every package format receives it automatically. +cp -f "$CEF_DIR/LICENSE.txt" "$DEST/CEF-LICENSE.txt" + # Strip debug symbols: CEF ships libcef.so unstripped (~1.3 GB → 241 MB). # Same approach as OutSystems cef.redist.linux and Spotify's desktop client. for lib in "$DEST"/libcef.so "$DEST"/libEGL.so "$DEST"/libGLESv2.so; do diff --git a/scripts/cef/package.sh b/scripts/cef/package.sh index e7ddc1d7e..9688f2258 100755 --- a/scripts/cef/package.sh +++ b/scripts/cef/package.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash -#MISE description="Package the CEF build into an AppImage" -#MISE tools={"github:AppImage/appimagetool" = {version = "1.9.1", matching = ".AppImage"}} -# deb/rpm/archlinux/snap come from GoReleaser. +#MISE description="Package the CEF build for Linux" +#MISE tools={nfpm="2.47.0", "github:AppImage/appimagetool" = {version = "1.9.1", matching = ".AppImage"}} # Usage: scripts/cef/package.sh [version] [binary-path] [display-name] set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" @@ -9,6 +8,16 @@ cd "$ROOT" VERSION="${1:-$(grep -m1 '"version":' src-tauri/tauri.conf.json | sed 's/.*: *"\(.*\)".*/\1/')}" : "${VERSION:?version not found in src-tauri/tauri.conf.json}" +DEB_VERSION="$VERSION" +RPM_VERSION="$VERSION" +RPM_ITERATION=1 +if [[ "$VERSION" == *-* ]]; then + BASE_VERSION="${VERSION%%-*}" + PRERELEASE="${VERSION#*-}" + DEB_VERSION="${BASE_VERSION}~${PRERELEASE}" + RPM_VERSION="$BASE_VERSION" + RPM_ITERATION="0.${PRERELEASE}" +fi STAGE="$ROOT/src-tauri/target/release" OUT="$STAGE/bundle" @@ -46,7 +55,7 @@ else fi rm -rf "$WORK" -mkdir -p "$OUT/appimage" +mkdir -p "$OUT/deb" "$OUT/rpm" "$OUT/appimage" bash scripts/cef/stage.sh "$WORK/stage" "$DISPLAY_NAME" @@ -80,6 +89,31 @@ stage_appindicator() { } stage_appindicator "$APPDIR/usr/bin" +# The AppImage mount is nosuid, so Chrome's setuid sandbox cannot run there. +rm -f "$APPDIR/usr/bin/chrome-sandbox" + +if command -v nfpm >/dev/null 2>&1; then + PKGROOT="$WORK/pkgroot" + mkdir -p "$PKGROOT/opt/sable" "$PKGROOT/usr/bin" "$PKGROOT/usr/share/applications" + cp -a "$WORK/stage/runtime/." "$PKGROOT/opt/sable/" + cp -f "$BIN_PATH" "$PKGROOT/opt/sable/sable" + chmod 755 "$PKGROOT/opt/sable/sable" + cat > "$PKGROOT/usr/bin/sable" <<'EOF' +#!/bin/sh +exec /opt/sable/sable "$@" +EOF + chmod 755 "$PKGROOT/usr/bin/sable" + cp -a "$WORK/stage/share/." "$PKGROOT/usr/share/" + + PKGROOT="$PKGROOT" PKG_VERSION="$DEB_VERSION" PKG_RELEASE=1 nfpm pkg -f nfpm.yaml -p deb \ + -t "$OUT/deb/Sable-${VERSION}-linux-x86_64.deb" + PKGROOT="$PKGROOT" PKG_VERSION="$RPM_VERSION" PKG_RELEASE="$RPM_ITERATION" nfpm pkg -f nfpm.yaml -p rpm \ + -t "$OUT/rpm/Sable-${VERSION}-linux-x86_64.rpm" +else + echo "nfpm not found" >&2 + exit 1 +fi + cp -f "$WORK/stage/share/applications/sable.desktop" "$APPDIR/sable.desktop" cp -f src-tauri/icons/128x128.png "$APPDIR/sable.png" cat > "$APPDIR/AppRun" <<'EOF' @@ -93,4 +127,4 @@ chmod 755 "$APPDIR/AppRun" APPIMAGE_EXTRACT_AND_RUN=1 ARCH=x86_64 "$APPIMAGETOOL_CMD" "$APPDIR" \ "$OUT/appimage/Sable-${VERSION}-linux-x86_64.AppImage" -echo "AppImage in: $OUT/appimage" +echo "Packages in: $OUT"