This document is primarily target at zellij maintainers in need to (prepare to) release a new zellij version.
This section explains how to do a "dry-run" of the release process. This is useful to check if a release is successful beforehand, i.e. before publishing it to the world. Because there is no "undo"-button for a real release as described below, it is recommended to perform a simulated release first.
You only need a publicly accessible Git repository to provide a cargo registry.
The setup explained below will host a third-party cargo registry software
(ktra) locally on your PC. In order for
cargo
to pick this up and be able to work with it, we must perform a few
modifications to the zellij repository and other components. Once setup, we
release a zellij version to this private registry and install zellij from there
to make sure it works as expected.
- Create a cargo index repository
- Create a new repo on some git forge (GitHub/GitLab/...)
- Clone the repo with HTTPS (not SSH), we'll refer to the
https://
clone-url as$INDEX_REPO
for the remainder of this text - Add a file named
config.json
with the following content in the root:{"dl":"http://localhost:8000/dl","api":"http://localhost:8000"}
- Generate an access token for full repo access, we'll refer to this as
$TOKEN
for the remained of this text - Create and push a commit with these changes. Provide the following HTTPS
credentials:
- Username: Your git-forge username
- Password:
$TOKEN
- Prepare the zellij repo
cd
into your local copy of the zellij repository- Add a new cargo registry to
.cargo/config.toml
like this:[registries] ktra = { index = "https://$INDEX_REPO" }
- Modify all
Cargo.toml
in the zellij repo to retrieve the individual zellij subcrates from the private registry:- Find all dependencies that look like this:
zellij-utils = { path = "../zellij-utils/", version = "XXX" }
- Change them to look like this
zellij-utils = { path = "../zellij-utils/", version = "XXX", registry = "ktra" }
- This applies to all zellij subcrates, e.g.
zellij-client
,zellij-server
, ... You can ignore the plugins, because these aren't released as sources.
- Find all dependencies that look like this:
- Launch your private registry
- Create the file
~/.cargo/config.toml
with the following content:[registries.ktra] index = "https://$INDEX_REPO"
- Install
ktra
, the registry server:cargo install ktra
- In a separate shell/pane/whatever, navigate to some folder where you want to store all data for the registry
- Create a config file for
ktra
namedktra.toml
there with the following content:[index_config] remote_url = "https://$INDEX_REPO" https_username = "your-git-username" https_password = "$TOKEN" branch = "main" # Or whatever branch name you used
- Launch ktra (with logging to see what happens):
RUST_LOG=debug ktra
- Get a registry token for
ktra
(The details don't really matter, unless you want to reuse this registry):curl -X POST -H 'Content-Type: application/json' -d '{"password":"PASSWORD"}' http://localhost:8000/ktra/api/v1/new_user/ALICE
- Login to the registry with the token you received as reply to the
previous command:
cargo login --registry ktra "KTRA_TOKEN"
- Create the file
- Install safety measures to prevent accidentally performing a real release:
- In your
zellij
repo, remove all configured remotes that allow you to push/publish directly to the zellij main GitHub repo. Setup a fork of the main zellij repo instead and configure a remote that allows you to push/publish to that. Please, this is very important. - Comment out the entire
[registry]
section in~/.cargo/credentials
to prevent accidentally pushing a new release tocrates.io
.
- In your
- Simulate a release
- Go back to the zellij repo, type:
cargo x publish --git-remote <YOUR_ZELLIJ_FORK> --cargo-registry ktra
- A prompt will open with the commit message for the release commit. Just save and close your editor to continue
- If all goes well, the release will be done in a few minutes and all the
crates are published to the private
ktra
registry!
- Go back to the zellij repo, type:
- Testing the release binary
- Install zellij from the registry to some local directory like this:
$ cargo install --registry ktra --root /tmp zellij
- Execute the binary to see if all went well:
$ /tmp/bin/zellij
- Install zellij from the registry to some local directory like this:
- Cleaning up
- Uncomment the
[registry]
section in~/.cargo/config.toml
- Restore your original git remotes for the zellij repo
- Undo your last commit:
$ git reset --hard HEAD~1
- Undo your last commit in the remote zellij repo:
$ git push --force <YOUR_ZELLIJ_FORK>
- Delete the release tag:
$ git tag -d "vX.Y.Z"
- Delete the release tag in the remote zellij repo
$ git push <YOUR_ZELLIJ_FORK> --force --delete "vX.Y.Z"
- Uncomment the
You're done! 🎉