Files
signed/script/bundle-snap
T
reya a85b5ee87b
Rust / build (macos-latest, stable) (push) Waiting to run
Rust / build (ubuntu-latest, stable) (push) Waiting to run
Rust / build (windows-latest, stable) (push) Waiting to run
Build and Release / Build macos-x64 (push) Waiting to run
Build and Release / Build macos-arm64 (push) Waiting to run
Build and Release / Build linux-arm64 (push) Waiting to run
Build and Release / Build linux-x64 (push) Waiting to run
Build and Release / Build windows-arm64 (push) Waiting to run
Build and Release / Build windows-x64 (push) Waiting to run
Build and Release / Create Release (push) Blocked by required conditions
fix: snap build
2026-09-14 14:38:25 +07:00

58 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euxo pipefail
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <release_version>"
exit 1
fi
ARCH=$(uname -m)
# Snap uses its own architecture names, which must match the file name and
# the architecture asserted inside the .snap. `x86_64`/`aarch64` here would
# produce a file like signed_1.0.0_x86_64.snap that snapd cannot match.
#
# The source tarball is named by `script/bundle-linux` after `uname -m`, so it
# keeps the x86_64/aarch64 spelling rather than the snap-native one.
case "$ARCH" in
x86_64|amd64) ARCH_SUFFIX="amd64"; TARBALL_ARCH_SUFFIX="x86_64" ;;
aarch64|arm64) ARCH_SUFFIX="arm64"; TARBALL_ARCH_SUFFIX="aarch64" ;;
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
esac
# Setup GUI files
mkdir -p snap/gui
export DO_STARTUP_NOTIFY="true"
export APP_NAME="Signed"
export APP_ICON="\${SNAP}/meta/gui/signed.png"
export APP_ARGS="%U"
envsubst < "desktop/resources/signed.desktop.in" > "snap/gui/signed.desktop"
cp "desktop/resources/icon.png" "snap/gui/signed.png"
# Generate snapcraft.yaml with version and architecture
RELEASE_VERSION="$1" TARBALL_ARCH_SUFFIX="$TARBALL_ARCH_SUFFIX" envsubst < desktop/resources/snap/snapcraft.yaml.in > snap/snapcraft.yaml
# Clean previous builds
snapcraft clean
# Build snap with architecture in filename
SNAP_NAME="signed_${1}_${ARCH_SUFFIX}.snap"
snapcraft --destructive-mode --output "$SNAP_NAME"
echo "Created snap package: $SNAP_NAME"
cat <<'EOF'
Install locally (local builds are unsigned, so snapd requires --dangerous; a
plain `snap install ./file.snap` fails with "cannot find signatures with
metadata for snap/component ..."):
sudo snap install --dangerous ./signed_<version>_amd64.snap
Distribute publicly via the Snap Store (signs the snap, users can then run
plain `snap install signed`):
snapcraft login
snapcraft upload ./signed_<version>_amd64.snap
snapcraft release signed <uploaded-revision> stable
EOF