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
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
echo "::error::the workspace version ${workspace_version} in Cargo.toml does not match the interface version ${interface_version}, see scripts/bump-version.sh"
exit 1
fi
- name: Check crates can be published
# the release workflow publishes the crates when a release is published, too late to find a
# crate can't be published. The cli is verified against the library being published with it.
run: cargo publish --dry-run --locked -p componentized-constants -p componentized-constants-cli
- name: Build components
run: make components
- name: Collect components.tar
Expand Down
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ version = "0.1.1-dev"

[workspace.dependencies]
anyhow = "1"
componentized-constants = { path = "./crates/componentized-constants" }
# published with the cli, the cli requires the library at exactly the same version, kept in step by
# scripts/bump-version.sh
componentized-constants = { path = "./crates/componentized-constants", version = "=0.1.1-dev" }
futures = { version = "0.3", default-features = false, features = ["executor"] }
test-harness = { path = "./crates/test-harness" }
wasmtime = { version = "49", default-features = false, features = ["anyhow", "component-model", "component-model-async", "cranelift", "runtime"] }
Expand Down
10 changes: 9 additions & 1 deletion scripts/bump-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ if ! grep -qF "$workflow_default" "$workflow"; then
exit 1
fi

# the cli requires the library at exactly the current version, publishing fails without a version
# requirement, checked before changing anything
library_requirement="${LIBRARY} = { path = \"./crates/${LIBRARY}\", version = \"=${old}\" }"
if ! grep -qxF "$library_requirement" Cargo.toml; then
echo "unable to find the ${LIBRARY} requirement on the current version in Cargo.toml, expected: ${library_requirement}" >&2
exit 1
fi

old_re="${old//./\\.}"
# references to the package or one of its interfaces, an interface named for a keyword is escaped
# with `%`, e.g. `componentized:constants/%u8@0.1.1-dev`
Expand All @@ -93,7 +101,7 @@ fi
# the version in the [workspace.package] section, inherited by the crates
perl -pi -e 'if (/^\[workspace\.package\]/ .. /^\[(?!workspace\.package\])/) { s/^version = "[^"]*"/version = "'"${new}"'"/ }' Cargo.toml
echo "updated the workspace version in Cargo.toml"
perl -pi -e 's/^(\Q'"${LIBRARY}"'\E = \{.*\bversion = ")[^"]*(")/${1}'"${new}"'${2}/' Cargo.toml
perl -pi -e 's/^(\Q'"${LIBRARY}"'\E = \{.*\bversion = "=)[^"]*(")/${1}'"${new}"'${2}/' Cargo.toml
echo "updated the ${LIBRARY} requirement in Cargo.toml"

perl -pi -e 's{^(\s+)\Q'"${workflow_default}"'\E$}{${1}'"${workflow_default/\"${old}\"/\"${new}\"}"'}' "$workflow"
Expand Down
Loading