chore: prepare to release

This commit is contained in:
2025-08-02 13:16:24 +07:00
parent c188f12993
commit 80c649f9a0
21 changed files with 462 additions and 85 deletions

View File

@@ -29,7 +29,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
@@ -42,12 +42,6 @@ jobs:
toolchain: stable
cache: true
- name: Install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y gcc g++ libasound2-dev libfontconfig-dev libwayland-dev libxkbcommon-x11-dev libssl-dev libzstd-dev libvulkan1 libgit2-dev make cmake clang jq netcat-openbsd git curl gettext-base elfutils libsqlite3-dev musl-tools musl-dev build-essential
- name: install cargo packager
run: |
cargo install cargo-packager --locked

View File

@@ -1,49 +0,0 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
version: 2
pro: true
before:
hooks:
- rustup default stable
- cargo install --locked cargo-zigbuild
- cargo fetch --locked
builds:
- builder: rust
flags:
- --release
- --package=coop
targets:
- x86_64-unknown-linux-gnu
- x86_64-apple-darwin
- x86_64-pc-windows-gnu
- aarch64-unknown-linux-gnu
- aarch64-apple-darwin
archives:
- formats: [tar.gz]
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
format_overrides:
- goos: windows
formats: [zip]
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
release:
footer: >-
---
Released by [GoReleaser](https://github.com/goreleaser/goreleaser).

52
Cargo.lock generated
View File

@@ -178,7 +178,7 @@ dependencies = [
[[package]]
name = "assets"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"anyhow",
"gpui",
@@ -417,7 +417,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "auto_update"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"anyhow",
"common",
@@ -987,7 +987,7 @@ dependencies = [
[[package]]
name = "client_keys"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"anyhow",
"global",
@@ -1089,7 +1089,7 @@ dependencies = [
[[package]]
name = "collections"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"indexmap",
"rustc-hash 2.1.1",
@@ -1124,7 +1124,7 @@ dependencies = [
[[package]]
name = "common"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"anyhow",
"chrono",
@@ -1180,7 +1180,7 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
[[package]]
name = "coop"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"anyhow",
"assets",
@@ -1491,7 +1491,7 @@ dependencies = [
[[package]]
name = "derive_refineable"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"proc-macro2",
"quote",
@@ -2277,7 +2277,7 @@ checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
[[package]]
name = "global"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"anyhow",
"dirs 5.0.1",
@@ -2371,7 +2371,7 @@ dependencies = [
[[package]]
name = "gpui"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"anyhow",
"as-raw-xcb-connection",
@@ -2464,7 +2464,7 @@ dependencies = [
[[package]]
name = "gpui_macros"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"heck 0.5.0",
"proc-macro2",
@@ -2476,7 +2476,7 @@ dependencies = [
[[package]]
name = "gpui_tokio"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"gpui",
"tokio",
@@ -2707,7 +2707,7 @@ dependencies = [
[[package]]
name = "http_client"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"anyhow",
"bytes",
@@ -2726,7 +2726,7 @@ dependencies = [
[[package]]
name = "http_client_tls"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"rustls",
"rustls-platform-verifier",
@@ -2820,7 +2820,7 @@ dependencies = [
[[package]]
name = "i18n"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"rust-i18n",
]
@@ -2937,7 +2937,7 @@ dependencies = [
[[package]]
name = "identity"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"anyhow",
"client_keys",
@@ -3527,7 +3527,7 @@ dependencies = [
[[package]]
name = "media"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"anyhow",
"bindgen 0.71.1",
@@ -4899,7 +4899,7 @@ dependencies = [
[[package]]
name = "refineable"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"derive_refineable",
"workspace-hack",
@@ -4936,7 +4936,7 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
name = "registry"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"anyhow",
"chrono",
@@ -5051,7 +5051,7 @@ dependencies = [
[[package]]
name = "reqwest_client"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"anyhow",
"bytes",
@@ -5587,7 +5587,7 @@ checksum = "0f7d95a54511e0c7be3f51e8867aa8cf35148d7b9445d44de2f943e2b206e749"
[[package]]
name = "semantic_version"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"anyhow",
"serde",
@@ -5722,7 +5722,7 @@ dependencies = [
[[package]]
name = "settings"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"anyhow",
"global",
@@ -5982,7 +5982,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "sum_tree"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"arrayvec",
"log",
@@ -6274,7 +6274,7 @@ dependencies = [
[[package]]
name = "theme"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"anyhow",
"gpui",
@@ -6403,7 +6403,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "title_bar"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"anyhow",
"common",
@@ -6774,7 +6774,7 @@ dependencies = [
[[package]]
name = "ui"
version = "1.0.0"
version = "1.0.0-beta"
dependencies = [
"anyhow",
"common",
@@ -6974,7 +6974,7 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
name = "util"
version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#4d79edc7533d6d0a8e29004c789bc6041a97993d"
source = "git+https://github.com/zed-industries/zed#a50d0f2586873fa92d4bfa3b09a3c332455002fa"
dependencies = [
"anyhow",
"async-fs",

View File

@@ -4,7 +4,7 @@ members = ["crates/*"]
default-members = ["crates/coop"]
[workspace.package]
version = "1.0.0"
version = "1.0.0-beta"
edition = "2021"
publish = false

View File

@@ -8,6 +8,24 @@ publish.workspace = true
name = "coop"
path = "src/main.rs"
[package.metadata.packager]
name = "Coop"
product-name = "Coop"
description = "Chat Freely, Stay Private on Nostr"
identifier = "dev.coop.Coop"
category = "SocialNetworking"
version = "1.0.0-beta"
out-dir = "./dist"
before-packaging-command = "cargo build --release"
resources = ["Cargo.toml", "src"]
icons = [
"resources/32x32.png",
"resources/128x128.png",
"resources/128x128@2x.png",
"resources/icon.icns",
"resources/icon.ico",
]
[dependencies]
assets = { path = "../assets" }
ui = { path = "../ui" }

View File

@@ -0,0 +1,14 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=$APP_NAME
GenericName=Chat Application
Comment=Chat Freely, Stay Private on Nostr.
TryExec=$APP_CLI
StartupNotify=$DO_STARTUP_NOTIFY
Exec=$APP_CLI $APP_ARGS
Icon=$APP_ICON
Categories=Network;InstantMessaging;
Keywords=chat;messaging;nostr;privacy;
MimeType=x-scheme-handler/nostr;x-scheme-handler/coop;
Actions=NewChat;

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>$APP_ID</id>
<metadata_license>MIT</metadata_license>
<project_license>AGPL-3.0-or-later and Apache-2.0 and GPL-3.0-or-later</project_license>
<name>$APP_NAME</name>
<summary>Chat Freely, Stay Private on Nostr</summary>
<developer id="dev.Coop">
<name translate="no">Ren Amamiya</name>
</developer>
<description>
<p>
Chat Freely, Stay Private on Nostr
</p>
</description>
<launchable type="desktop-id">$APP_ID.desktop</launchable>
<branding>
<color type="primary" scheme_preference="light">$BRANDING_LIGHT</color>
<color type="primary" scheme_preference="dark">$BRANDING_DARK</color>
</branding>
<content_rating type="oars-1.1">
<content_attribute id="social-chat">intense</content_attribute>
<content_attribute id="social-audio">intense</content_attribute>
</content_rating>
<url type="homepage">https://coopchat.com</url>
<url type="bugtracker">https://github.com/lumehq/coop/issues</url>
<url type="faq">https://coopchat.com/faq</url>
<url type="help">https://coopchat.com/docs/getting-started</url>
<url type="contact">https://coopchat.com/community-links</url>
<url type="vcs-browser">https://github.com/lumehq/coop</url>
<url type="contribute">https://github.com/lumehq/coop/blob/main/CONTRIBUTING.md</url>
<supports>
<internet>offline-only</internet>
</supports>
<recommends>
<control>pointing</control>
<control>keyboard</control>
<display_length compare="ge">768</display_length>
</recommends>
<screenshots>
<screenshot type="default">
<caption>Coop</caption>
<image>https://coopchat.com/img/flatpak/flatpak-1.png</image>
</screenshot>
</screenshots>
<releases>
@release_info@
<release version="0.0.0" date="1970-01-01">
<description>
<p>Dummy release to keep flatpak-builder AppStream metadata validation from complaining</p>
</description>
</release>
</releases>
</component>

View File

@@ -0,0 +1,58 @@
{
"id": "$APP_ID",
"runtime": "org.freedesktop.Platform",
"runtime-version": "23.08",
"sdk": "org.freedesktop.Sdk",
"sdk-extensions": ["org.freedesktop.Sdk.Extension.rust-stable"],
"command": "coop",
"finish-args": [
"--talk-name=org.freedesktop.Flatpak",
"--device=dri",
"--share=ipc",
"--share=network",
"--socket=wayland",
"--socket=fallback-x11",
"--socket=pulseaudio",
"--filesystem=host"
],
"build-options": {
"append-path": "/usr/lib/sdk/rust-stable/bin"
},
"modules": [
{
"name": "coop",
"buildsystem": "simple",
"build-options": {
"env": {
"APP_ID": "$APP_ID",
"APP_ICON": "$APP_ID",
"APP_NAME": "$APP_NAME",
"BRANDING_LIGHT": "$BRANDING_LIGHT",
"BRANDING_DARK": "$BRANDING_DARK",
"APP_CLI": "coop",
"APP_ARGS": "--foreground %U",
"DO_STARTUP_NOTIFY": "false"
}
},
"build-commands": [
"install -Dm644 $ICON_FILE.png /app/share/icons/hicolor/512x512/apps/$APP_ID.png",
"envsubst < coop.desktop.in > coop.desktop && install -Dm644 coop.desktop /app/share/applications/$APP_ID.desktop",
"envsubst < flatpak/coop.metainfo.xml.in > coop.metainfo.xml && install -Dm644 coop.metainfo.xml /app/share/metainfo/$APP_ID.metainfo.xml",
"sed -i -e '/@release_info@/{r flatpak/release-info/$CHANNEL' -e 'd}' /app/share/metainfo/$APP_ID.metainfo.xml",
"install -Dm755 bin/coop /app/bin/coop",
"install -Dm755 libexec/coop /app/libexec/coop",
"install -Dm755 lib/* -t /app/lib"
],
"sources": [
{
"type": "archive",
"path": "./target/release/$ARCHIVE"
},
{
"type": "dir",
"path": "./crates/coop/resources"
}
]
}
]
}

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

@@ -0,0 +1,58 @@
name: coop
title: Coop
base: core24
version: "$RELEASE_VERSION"
summary: The editor for what's next
description: |
Chat Freely, Stay Private on Nostr.
grade: stable
confinement: classic
compression: lzo
website: https://coopchat.com/
source-code: https://github.com/lumehq/coop
issues: https://github.com/lumehq/coop/issues
contact: https://reya.su
parts:
coop:
plugin: dump
source: "https://github.com/lumehq/coop/releases/download/v$RELEASE_VERSION/coop-linux-x86_64.tar.gz"
organize:
# These renames seem to not be necessary, but it's tidier.
bin: usr/bin
libexec: usr/libexec
stage-packages:
- libasound2t64
# snapcraft has a lint that this is unused, but without it Coop exits with
# "Missing Vulkan entry points: LibraryLoadFailure" in blade_graphics.
- libvulkan1
# snapcraft has a lint that this is unused, but without it Coop exits with
# "NoWaylandLib" when run with Wayland.
- libwayland-client0
- libxcb1
- libxkbcommon-x11-0
- libxkbcommon0
build-attributes:
- enable-patchelf
prime:
# Omit unneeded files from the tarball
- -lib
- -licenses.md
- -share
# Omit unneeded files from stage-packages
- -etc
- -usr/share/doc
- -usr/share/lintian
- -usr/share/man
apps:
coop:
command: usr/bin/coop
common-id: dev.coop.Coop
environment:
COOP_BUNDLE_TYPE: snap

View File

@@ -1,5 +1,5 @@
pub const APP_NAME: &str = "Coop";
pub const APP_ID: &str = "su.reya.coop";
pub const APP_ID: &str = "dev.coop.Coop";
pub const APP_PUBKEY: &str = "b1813fb01274b32cc5db6d1198e7c79dda0fb430899f63c7064f651a41d44f2b";
pub const KEYRING_URL: &str = "Coop Safe Storage";

View File

@@ -44,7 +44,7 @@ welcome:
title:
en: "Welcome to Coop"
subtitle:
en: "Secure Communication on Nostr."
en: "Chat Freely, Stay Private on Nostr."
onboarding:
choose_account:

123
script/bundle-linux Executable file
View File

@@ -0,0 +1,123 @@
#!/usr/bin/env bash
set -euxo pipefail
# Function for displaying help info
help_info() {
echo "
Usage: ${0##*/} [options]
Build a release .tar.gz for Linux.
Options:
-h, --help Display this help and exit.
--flatpak Set COOP_BUNDLE_TYPE=flatpak so that this can be included in system info
"
}
# Parse all arguments manually
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
help_info
exit 0
;;
--flatpak)
export COOP_BUNDLE_TYPE=flatpak
shift
;;
--)
shift
break
;;
-*)
echo "Unknown option: $1" >&2
help_info
exit 1
;;
*)
echo "Error: Unexpected argument: $1" >&2
help_info
exit 1
;;
esac
done
export COOP_BUNDLE=true
target_dir="${CARGO_TARGET_DIR:-target}"
version="$(script/get-crate-version coop)"
# Set RELEASE_VERSION so it's compiled into GPUI and it knows about the version.
export RELEASE_VERSION="${version}"
commit=$(git rev-parse HEAD | cut -c 1-7)
version_info=$(rustc --version --verbose)
host_line=$(echo "$version_info" | grep host)
target_triple=${host_line#*: }
musl_triple=${target_triple%-gnu}-musl
remote_server_triple=${REMOTE_SERVER_TARGET:-"${musl_triple}"}
rustup_installed=false
if command -v rustup >/dev/null 2>&1; then
rustup_installed=true
fi
export CC=$(which clang)
# Build binary in release mode
export RUSTFLAGS="${RUSTFLAGS:-} -C link-args=-Wl,--disable-new-dtags,-rpath,\$ORIGIN/../lib"
cargo build --release --target "${target_triple}" --package coop
# Strip debug symbols and save them for upload to DigitalOcean
objcopy --only-keep-debug "${target_dir}/${target_triple}/release/coop" "${target_dir}/${target_triple}/release/coop.dbg"
objcopy --strip-debug "${target_dir}/${target_triple}/release/coop"
gzip -f "${target_dir}/${target_triple}/release/coop.dbg"
# Move everything that should end up in the final package
# into a temp directory.
temp_dir=$(mktemp -d)
coop_dir="${temp_dir}/coop.app"
# Binary
mkdir -p "${coop_dir}/bin" "${coop_dir}/libexec"
cp "${target_dir}/${target_triple}/release/coop" "${coop_dir}/libexec/coop"
cp "${target_dir}/${target_triple}/release/cli" "${coop_dir}/bin/coop"
# Libs
find_libs() {
ldd ${target_dir}/${target_triple}/release/coop |\
cut -d' ' -f3 |\
grep -v '\<\(libstdc++.so\|libc.so\|libgcc_s.so\|libm.so\|libpthread.so\|libdl.so\|libasound.so\)'
}
mkdir -p "${coop_dir}/lib"
rm -rf "${coop_dir}/lib/*"
cp $(find_libs) "${coop_dir}/lib"
# Icons
mkdir -p "${coop_dir}/share/icons/hicolor/512x512/apps"
cp "crates/coop/resources/icon.png" "${coop_dir}/share/icons/hicolor/512x512/apps/coop.png"
mkdir -p "${coop_dir}/share/icons/hicolor/1024x1024/apps"
cp "crates/coop/resources/icon@2x.png" "${coop_dir}/share/icons/hicolor/1024x1024/apps/coop.png"
# .desktop
export DO_STARTUP_NOTIFY="true"
export APP_CLI="coop"
export APP_ICON="coop"
export APP_ARGS="%U"
export APP_NAME="Coop"
mkdir -p "${coop_dir}/share/applications"
envsubst < "crates/coop/resources/coop.desktop.in" > "${coop_dir}/share/applications/coop.desktop"
# Create archive out of everything that's in the temp directory
arch=$(uname -m)
target="linux-${arch}"
archive="coop-${target}.tar.gz"
rm -rf "${archive}"
remove_match="coop(-[a-zA-Z0-9]+)?-linux-$(uname -m)\.tar\.gz"
ls "${target_dir}/release" | grep -E ${remove_match} | xargs -d "\n" -I {} rm -f "${target_dir}/release/{}" || true
tar -czvf "${target_dir}/release/$archive" -C ${temp_dir} "coop.app"

21
script/flatpak/bundle-flatpak Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/../.."
shopt -s extglob
script/bundle-linux --flatpak
archive_match="zed(-[a-zA-Z0-9]+)?-linux-$(uname -m)\.tar\.gz"
archive=$(ls "target/release" | grep -E ${archive_match})
export ARCHIVE="$archive"
export APP_ID="dev.coop.Coop"
export APP_NAME="Coop"
export BRANDING_LIGHT="#99c1f1"
export BRANDING_DARK="#1a5fb4"
export ICON_FILE="icon"
envsubst < "crates/coop/resources/flatpak/manifest-template.json" > "$APP_ID.json"
flatpak-builder --user --install --force-clean build "$APP_ID.json"
flatpak build-bundle ~/.local/share/flatpak/repo "target/release/$APP_ID.flatpak" "$APP_ID"
echo "Created 'target/release/$APP_ID.flatpak'"

9
script/flatpak/deps Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
arch=$(arch)
fd_version=23.08
flatpak install -y --user org.freedesktop.Platform/${arch}/${fd_version}
flatpak install -y --user org.freedesktop.Sdk/${arch}/${fd_version}
flatpak install -y --user org.freedesktop.Sdk.Extension.rust-stable/${arch}/${fd_version}

0
script/freebsd Normal file → Executable file
View File

17
script/get-crate-version Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -eu
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <crate_name>" >&2
exit 1
fi
CRATE_NAME=$1
cargo metadata \
--no-deps \
--format-version=1 \
| jq \
--raw-output \
".packages[] | select(.name == \"${CRATE_NAME}\") | .version"

27
script/snap-build Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euxo pipefail
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <release_version>"
exit 1
fi
mkdir -p snap/gui
export DO_STARTUP_NOTIFY="true"
export APP_NAME="Coop"
export APP_CLI="coop"
export APP_ICON="\${SNAP}/meta/gui/coop.png"
export APP_ARGS="%U"
envsubst < "crates/coop/resources/coop.desktop.in" > "snap/gui/coop.desktop"
cp "crates/coop/resources/icon.png" "snap/gui/coop.png"
RELEASE_VERSION="$1" envsubst < crates/coop/resources/snap/snapcraft.yaml.in > snap/snapcraft.yaml
# Clean seems to be needed to actually check that the snapcraft.yaml
# works. For example, when a `stage-package` is removed, it will
# still remain on rebuild.
snapcraft clean
snapcraft

25
script/snap-try Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# This script is intended to be run after `snap-build`.
#
# It expects a version to be passed as the first argument, and expects
# the built `.snap` for that version to be in the current directory.
#
# This will uninstall the current `coop` snap, replacing it with a snap
# that directly uses the `snap/unpacked` directory.
set -euxo pipefail
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <release_version>"
exit 1
fi
# Rerun as root
[ "$UID" -eq 0 ] || exec sudo bash -e "$0" "$@"
snap remove coop || true
mkdir -p snap
rm -rf snap/unpacked
unsquashfs -dest snap/unpacked "coop_$1_amd64.snap"
snap try --classic snap/unpacked