tools/release/README.md
A command-line tool for managing SpacetimeDB releases and deployments.
Note: The permissions related to this tool are very complex. For publishing a package you will need to be a member of the clockwork labs org for that package and in the case of crates.io you will need to be added to each package individually. Generally it is recommended to not attempt to run this locally unless you know what you're doing. We recommend using our Github workflow which is already setup with the correct permissions/tokens. This allows anyone to publish a release: https://github.com/clockworklabs/SpacetimeDB/actions/workflows/release.yml
Platform Independence: This tool is designed to use minimal shell scripting and platform-specific commands, making it as platform-independent as possible.
CI/CD Integration: While the tool can be executed locally, it's primarily designed to run within GitHub workflows. This approach eliminates the need for local tool installations and special permissions or secret keys to perform releases.
Configurability: The tool provides fine-grained control over which components are released, allowing you to choose exactly what gets released and what doesn't.
This tool is part of the SpacetimeDB repository. To install it as a cargo subcommand:
cd tools/release
cargo install --path .
This will install the cargo-release binary to your ~/.cargo/bin directory, allowing you to run it as cargo release from anywhere.
To verify the installation:
cargo release --help
The release CLI provides commands for releasing various components of the SpacetimeDB ecosystem:
Release the following packages to crates.io:
cargo release crates v1.2.0
You can also perform a dry run to see what would be published without actually publishing:
cargo release crates v1.2.0 --dry-run
After each crate is published, the release waits for that crate version to become visible in the crates.io index before publishing dependent crates.
Release the TypeScript SDK to npm. This will:
pnpm publish which automatically triggers the prepublishOnly scriptprepublishOnly script will build, test, and size up the package@clockworklabs/spacetimedb-sdklatestcargo release npm 1.2.0
You can also perform a dry run to test the build and publish process without actually publishing:
cargo release npm 1.2.0 --dry-run
Note: In dry-run mode, pnpm publish --dry-run will be executed to verify the build and packaging process works correctly, but the package will NOT be published to npm.
Prerequisites:
npm install -g pnpm)npm login)@clockworklabs/spacetimedb-sdk packageRelease the C# SDK to both NuGet and the Unity SDK repository. This unified release process:
dotnet packsdks/csharp/packages/spacetimedb.bsatn.runtime directorydotnet restore to populate DLLs from NuGet cache (creates {version}/ directory).meta files from sdks/csharp/release~/spacetimedb.bsatn.runtime/unversioned/ to packagesrelease/mirror/csharp branchsdks/csharpclockworklabs/com.clockworklabs.spacetimedbsdk as release/latestcargo release csharp 1.2.0
You can also perform a dry run to test the build process without publishing:
cargo release csharp 1.2.0 --dry-run
Note: In dry-run mode, the DLLs will be built to verify the build process works correctly, but packages will NOT be pushed to NuGet or the Unity SDK repository.
Why Combined? The same DLLs are used for both NuGet packages and the Unity SDK. Building them once ensures consistency and avoids potential version mismatches.
Prerequisites:
sudo apt-get install nuget mono-completebrew install nuget[email protected]:clockworklabs/com.clockworklabs.spacetimedbsdk.gitRelease the SpacetimeDB public Docker container to DockerHub. This will:
cargo release docker v1.2.0
You can also perform a dry run to test the build process without pushing to DockerHub:
cargo release docker v1.2.0 --dry-run
Note: In dry-run mode, the containers will be built locally to verify the build process works correctly, but they will NOT be pushed to DockerHub.
Prerequisites:
docker login)Publish the GitHub release after all package and artifact release steps have completed. This will:
attach-artifacts.yml workflow to upload client binariescargo release github-release v1.2.0
If the GitHub release is already published, the command treats that as success and exits without re-uploading artifacts.
Prerequisites:
GH_TOKEN must have permission to dispatch workflows and update releasesTo perform a full release of all components:
cargo release --all
You can also skip specific targets:
cargo release --all --skip docker
Or skip multiple targets:
cargo release --all --skip docker --skip nuget
The release tool is integrated with GitHub Actions via the .github/workflows/release.yml workflow.
The Docker release job automatically:
Cargo.toml:latest (release mode only)To run the Docker release workflow in non-dry-run mode, you need to configure the following in your GitHub repository:
Variables (Settings → Secrets and variables → Actions → Variables):
DOCKERHUB_USERNAME: Your DockerHub usernameSecrets (Settings → Secrets and variables → Actions → Secrets):
DOCKERHUB_TOKEN: Your DockerHub access token (create one at https://hub.docker.com/settings/security)For the crates.io release workflow:
Secrets:
CARGO_REGISTRY_TOKEN: Your crates.io API token (create one at https://crates.io/settings/tokens)
For the C# SDK release workflow (NuGet + Unity):
Secrets:
NUGET_API_KEY: Your NuGet API key (create one at https://www.nuget.org/account/apikeys)
push permission. It is recommended that you scope your token to just the required packages. You can also use wildcards here like SpacetimeDB.*.For the NPM release workflow:
Configure npm trusted publishing for this workflow in the npm package settings.
v1.1.1To add a new release target, implement the ReleaseTarget trait and add it to the appropriate modules.