Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "icp-cli-network-launcher"
version = "12.0.0-2026-03-19-04-43"
version = "12.0.0-83c3f95e8c4ce28e02493df83df5f84a166451c0"
edition = "2024"
authors = ["DFINITY Stiftung <sdk@dfinity.org>"]
license = "Apache-2.0"
Expand All @@ -15,7 +15,7 @@ clap = { version = "4.5.53", features = ["derive", "env"] }
hex = "0.4.3"
ic_principal = "0.1.1"
notify = "8.2.0"
pocket-ic = { git = "https://github.com/dfinity/ic", rev = "d17cf0bcd330e94f868cc7d19d0ac860cbe64198" }
pocket-ic = { git = "https://github.com/dfinity/ic", rev = "83c3f95e8c4ce28e02493df83df5f84a166451c0" }
reqwest = { version = "0.12.24", default-features = false, features = ["rustls-tls", "json"] }
semver = "1.0.27"
serde = { version = "1.0.228", features = ["derive"] }
Expand Down
39 changes: 29 additions & 10 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,31 @@ fi

v=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name=="icp-cli-network-launcher") | .version')
source=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name=="icp-cli-network-launcher") | .dependencies[] | select(.name=="pocket-ic") | .source')
reg='([0-9.]+)(-((r[0-9]+$)|(([0-9-]+)(\.(r[0-9]+))?)))?'
if [[ "$v" =~ $reg ]]; then
# Parse version: X.Y.Z with optional suffix
if [[ "$v" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(-.+)?$ ]]; then
pkgver=${BASH_REMATCH[1]}
icdate=${BASH_REMATCH[6]:-}
patchrel=${BASH_REMATCH[4]:-${BASH_REMATCH[8]:-}}
suffix=${BASH_REMATCH[2]:-}
suffix=${suffix#-}
else
die "could not parse package version $v - should be 1.2.3[-r1] or 1.2.3-2026-01-29-16-08[.r1]"
die "could not parse package version $v"
fi
if [[ "$v" = *"-"* ]]; then
githash=""
icdate=""
patchrel=""
if [[ -z "$suffix" ]]; then
:
elif [[ "$suffix" =~ ^(r[0-9]+)$ ]]; then
patchrel=${BASH_REMATCH[1]}
elif [[ "$suffix" =~ ^([0-9a-f]{40})(-(r[0-9]+))?$ ]]; then
githash=${BASH_REMATCH[1]}
patchrel=${BASH_REMATCH[3]:-}
elif [[ "$suffix" =~ ^([0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2})(\.(r[0-9]+))?$ ]]; then
icdate=${BASH_REMATCH[1]}
patchrel=${BASH_REMATCH[3]:-}
else
die "could not parse package version $v - expected 1.2.3[-r1], 1.2.3-2026-01-29-16-08[.r1], or 1.2.3-<git-hash>[-r1]"
fi
if [[ -n "$icdate" || -n "$githash" || -n "$patchrel" ]]; then
[[ "$source" = "git+"* ]] || die "package.version is patch but pocket-ic dependency is not git"
else
[[ "$source" != "git+"* ]] || die "package.version is not patch but pocket-ic dependency is git"
Expand All @@ -59,13 +75,16 @@ outdir="${dir:-"dist/${name}"}"
cargo build --release "${cargo_args[@]}"
mkdir -p "${outdir}"
cp "target/release/icp-cli-network-launcher" "${outdir}/"
if [[ -z "$icdate" ]]; then
echo "Fetching pocket-ic from: https://github.com/dfinity/pocketic/releases/download/${pkgver}/pocket-ic-${arch}-${os}.gz"
curl --proto '=https' -sSfL --tlsv1.2 "https://github.com/dfinity/pocketic/releases/download/${pkgver}/pocket-ic-${arch}-${os}.gz" -o "${outdir}/pocket-ic.gz" ${GITHUB_TOKEN:+ -H "Authorization: Bearer ${GITHUB_TOKEN}" }
else
if [[ -n "$githash" ]]; then
echo "Fetching pocket-ic from: https://download.dfinity.systems/ic/${githash}/binaries/${arch}-${os}/pocket-ic.gz"
curl --proto '=https' -sSfL --tlsv1.2 "https://download.dfinity.systems/ic/${githash}/binaries/${arch}-${os}/pocket-ic.gz" -o "${outdir}/pocket-ic.gz"
elif [[ -n "$icdate" ]]; then
icver=$(sed 's/-/_/3' <<<"${icdate}")
echo "Fetching pocket-ic from: https://github.com/dfinity/ic/releases/download/release-${icver}-base/pocket-ic-${arch}-${os}.gz"
curl --proto '=https' -sSfL --tlsv1.2 "https://github.com/dfinity/ic/releases/download/release-${icver}-base/pocket-ic-${arch}-${os}.gz" -o "${outdir}/pocket-ic.gz" ${GITHUB_TOKEN:+ -H "Authorization: Bearer ${GITHUB_TOKEN}" }
else
echo "Fetching pocket-ic from: https://github.com/dfinity/pocketic/releases/download/${pkgver}/pocket-ic-${arch}-${os}.gz"
curl --proto '=https' -sSfL --tlsv1.2 "https://github.com/dfinity/pocketic/releases/download/${pkgver}/pocket-ic-${arch}-${os}.gz" -o "${outdir}/pocket-ic.gz" ${GITHUB_TOKEN:+ -H "Authorization: Bearer ${GITHUB_TOKEN}" }
fi
gunzip -f "${outdir}/pocket-ic.gz"
chmod a+x "${outdir}/pocket-ic"
Expand Down
Loading