Snap support (#1095)

Adds Snap support, though I'm still waiting to hear back from the
Snapcraft team about getting our package listed.

closes #1092
This commit is contained in:
Evan Simkowitz 2024-10-21 18:13:19 -07:00 committed by GitHub
parent 1fc6dd7c1a
commit 81a8a7f3eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 12 deletions

View File

@ -40,11 +40,8 @@ jobs:
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install --no-install-recommends -y libarchive-tools libopenjp2-tools rpm squashfs-tools sudo apt-get install --no-install-recommends -y libarchive-tools libopenjp2-tools rpm squashfs-tools
sudo snap install snapcraft --classic
# We use Zig instead of glibc for cgo compilation as it is more-easily statically linked sudo snap install zig --classic --beta # We use Zig instead of glibc for cgo compilation as it is more-easily statically linked
- name: Setup Zig (Linux only)
if: matrix.platform == 'linux'
run: sudo snap install zig --classic --beta
# The pre-installed version of the AWS CLI has a segfault problem so we'll install it via Homebrew instead. # The pre-installed version of the AWS CLI has a segfault problem so we'll install it via Homebrew instead.
- name: Upgrade AWS CLI (Mac only) - name: Upgrade AWS CLI (Mac only)
@ -122,8 +119,15 @@ jobs:
path: ${{env.STATIC_DOCSITE_PATH}} path: ${{env.STATIC_DOCSITE_PATH}}
# Build and upload packages # Build and upload packages
- name: Build (not Windows) - name: Build (Linux)
if: matrix.platform != 'windows' if: matrix.platform == 'linux'
run: task package
env:
USE_SYSTEM_FPM: true # Ensure that the installed version of FPM is used rather than the bundled one.
STATIC_DOCSITE_PATH: ${{env.STATIC_DOCSITE_PATH}}
SNAPCRAFT_BUILD_ENVIRONMENT: host
- name: Build (Darwin)
if: matrix.platform == 'darwin'
run: task package run: task package
env: env:
USE_SYSTEM_FPM: true # Ensure that the installed version of FPM is used rather than the bundled one. USE_SYSTEM_FPM: true # Ensure that the installed version of FPM is used rather than the bundled one.
@ -133,7 +137,7 @@ jobs:
APPLE_APP_SPECIFIC_PASSWORD: ${{ matrix.platform == 'darwin' && secrets.PROD_MACOS_NOTARIZATION_PWD_2 }} APPLE_APP_SPECIFIC_PASSWORD: ${{ matrix.platform == 'darwin' && secrets.PROD_MACOS_NOTARIZATION_PWD_2 }}
APPLE_TEAM_ID: ${{ matrix.platform == 'darwin' && secrets.PROD_MACOS_NOTARIZATION_TEAM_ID_2 }} APPLE_TEAM_ID: ${{ matrix.platform == 'darwin' && secrets.PROD_MACOS_NOTARIZATION_TEAM_ID_2 }}
STATIC_DOCSITE_PATH: ${{env.STATIC_DOCSITE_PATH}} STATIC_DOCSITE_PATH: ${{env.STATIC_DOCSITE_PATH}}
- name: Build (Windows only) - name: Build (Windows)
if: matrix.platform == 'windows' if: matrix.platform == 'windows'
run: task package run: task package
env: env:

View File

@ -58,7 +58,7 @@ const config = {
artifactName: "${name}-${platform}-${arch}-${version}.${ext}", artifactName: "${name}-${platform}-${arch}-${version}.${ext}",
category: "TerminalEmulator", category: "TerminalEmulator",
executableName: pkg.name, executableName: pkg.name,
target: ["zip", "deb", "rpm", "AppImage", "pacman"], target: ["zip", "deb", "rpm", "snap", "AppImage", "pacman"],
synopsis: pkg.description, synopsis: pkg.description,
description: null, description: null,
desktop: { desktop: {
@ -84,6 +84,11 @@ const config = {
appImage: { appImage: {
license: "LICENSE", license: "LICENSE",
}, },
snap: {
base: "core22",
confinement: "classic",
allowNativeWayland: true,
},
publish: { publish: {
provider: "generic", provider: "generic",
url: "https://dl.waveterm.dev/releases-w2", url: "https://dl.waveterm.dev/releases-w2",
@ -111,9 +116,6 @@ const config = {
}) })
.filter((f) => f.isFile() && f.name.startsWith("wavesrv")) .filter((f) => f.isFile() && f.name.startsWith("wavesrv"))
.forEach((f) => fs.chmodSync(path.resolve(f.parentPath ?? f.path, f.name), 0o755)); // 0o755 corresponds to -rwxr-xr-x .forEach((f) => fs.chmodSync(path.resolve(f.parentPath ?? f.path, f.name), 0o755)); // 0o755 corresponds to -rwxr-xr-x
} else if (context.electronPlatformName === "linux") {
const chromeSandboxPath = path.resolve(context.appOutDir, "chrome-sandbox");
fs.chmodSync(chromeSandboxPath, 0o4755);
} }
}, },
}; };