From 46966c6580c4982cdc6e3f869076381f6e9f067f Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Fri, 12 Aug 2022 14:18:34 -0700 Subject: [PATCH 1/2] fix: release process should start --clean This matches the step already documented in the release process notes. --- scripts/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release.sh b/scripts/release.sh index c1c77e0060..5cf3a79fa9 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -96,7 +96,7 @@ validate_default_project() { cd hello_world echo "Starting the local 'replica' as a background process." - $dfx_rc start --background + $dfx_rc start --background --clean echo "Installing webpack and webpack-cli" npm install webpack webpack-cli From 0349463e9db39ba99bbabadd7956187367f7f6b0 Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Fri, 12 Aug 2022 15:12:22 -0700 Subject: [PATCH 2/2] fix: for release script calling dfx generate to incorrect dfx Since package.json now specifies to call `dfx generate`, we need to alter the release script so that this calls the release candidate dfx executable rather than another one. To do this, the release script now prepends the target directory to the PATH, and calls dfx using that. This avoids errors like this during the release process: Creating canister hello_world_frontend... hello_world_frontend canister created with canister id: ryjl3-tyaaa-aaaaa-aaaba-cai Building canisters... Building frontend... WARN: Warning: The version of DFX used (0.9.1-303-g4e0b172d) is different than the version being run (0.11.0). This might happen because your dfx.json specifies an older version, or DFX_VERSION is set in your environment. We are forwarding the command line to the old version. To disable this warning, set the DFX_WARNING=-version_check environment variable. Building canisters before generate for Motoko --- scripts/release.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index 5cf3a79fa9..10e8d858bd 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -27,7 +27,7 @@ term_reset() { get_parameters() { [ "$#" -eq 1 ] || die "Usage: $0 " - [[ "$1" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(-(beta|alpha)\.[0-9]+)?$ ]] || \ + [[ "$1" =~ ^([0-9]+\.[0-9]+\.[0-9]+)(-([A-Za-z]+)\.[0-9]+)?$ ]] || \ die "'$1' is not a valid semantic version" export FINAL_RELEASE_BRANCH="release-${BASH_REMATCH[1]}" @@ -54,21 +54,21 @@ pre_release_check() { } # -# build the release candidate and export these environment variables: -# dfx_rc dfx release candidate executable +# build the release candidate and prepend the target directory to the PATH. +# package.json now specifies to call "dfx generate", which is why dfx needs to be on the path. # build_release_candidate() { announce "Building dfx release candidate." cargo clean --release cargo build --release --locked - x="$(pwd)/target/release/dfx" - export dfx_rc="$x" + x="$(pwd)/target/release" + "$x/dfx" --version - echo "Checking for dfx release candidate at $dfx_rc" - test -x "$dfx_rc" + export PATH="$x:$PATH" + [ "$(which dfx)" == "$x/dfx" ] || die "expected dfx on path ($(which dfx) to match built dfx ($x/dfx)" echo "Deleting existing dfx cache to make sure not to use a stale binary." - $dfx_rc cache delete + dfx cache delete } wait_for_response() { @@ -92,25 +92,25 @@ validate_default_project() { cd "$PROJECTDIR" echo "Creating new project." - $dfx_rc new hello_world + dfx new hello_world cd hello_world echo "Starting the local 'replica' as a background process." - $dfx_rc start --background --clean + dfx start --background --clean echo "Installing webpack and webpack-cli" npm install webpack webpack-cli npm install terser-webpack-plugin echo "Deploying canisters." - $dfx_rc deploy + dfx deploy echo "Calling the canister." - $dfx_rc canister call hello_world_backend greet everyone + dfx canister call hello_world_backend greet everyone - hello_world_frontend_canister_id=$($dfx_rc canister id hello_world_frontend) - application_canister_id=$($dfx_rc canister id hello_world_backend) - candid_ui_id=$($dfx_rc canister id __Candid_UI) + hello_world_frontend_canister_id=$(dfx canister id hello_world_frontend) + application_canister_id=$(dfx canister id hello_world_backend) + candid_ui_id=$(dfx canister id __Candid_UI) export hello_world_frontend_url="http://localhost:8000/?canisterId=$hello_world_frontend_canister_id" export candid_ui_url="http://localhost:8000/?canisterId=$candid_ui_id&id=$application_canister_id" @@ -147,7 +147,7 @@ validate_default_project() { wait_for_response 'no errors on console' echo - $dfx_rc stop + dfx stop ) }