|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# get command line arguments to pass them to `cargo upgrade` command |
| 4 | +# By default, we allow upgrading all dependencies to the latest one. |
| 5 | +# If you want to upgrade only to the compatible version, launch script with option `--compatbile` |
| 6 | +CARGO_UPGRADE_OPTIONS=${*:-"--incompatible"} |
| 7 | + |
| 8 | +# Need to install `cargo-edit` to execute `cargo upgrade` and `cargo set-version` commands |
| 9 | + |
| 10 | +# Upgrade Rust outdated dependencies |
| 11 | +cargo upgrade "${CARGO_UPGRADE_OPTIONS}" --verbose |
| 12 | +# cargo upgrade -i allow --verbose |
| 13 | +# Let the CI run the tests at the end of the script |
| 14 | +# cargo test --all-features |
| 15 | +git commit -am "chore: update Rust dependencies" |
| 16 | + |
| 17 | +# Bump Rust crates versions |
| 18 | +cargo set-version --bump patch |
| 19 | +git commit -am "chore: bump crates versions" |
| 20 | + |
| 21 | +# Upgrade the documentation website dependencies |
| 22 | +pushd docs/website || exit |
| 23 | +make upgrade |
| 24 | +popd || exit |
| 25 | +git commit -am "chore: upgrade doc dependencies |
| 26 | +
|
| 27 | +By running 'make upgrade' command." |
| 28 | + |
| 29 | +# Upgrade the explorer dependencies |
| 30 | +pushd mithril-explorer || exit |
| 31 | +make upgrade |
| 32 | +popd || exit |
| 33 | +git commit -am "chore: upgrade explorer dependencies |
| 34 | +
|
| 35 | +By running 'make upgrade' command." |
| 36 | + |
| 37 | +# Upgrade www/ and www-test/ dependencies |
| 38 | +pushd mithril-client-wasm || exit |
| 39 | +make upgrade-www-deps |
| 40 | +popd || exit |
| 41 | + |
| 42 | +git commit -am "chore: upgrade mithril client wasm 'www' and 'www-test' dependencies |
| 43 | +
|
| 44 | +By running 'make upgrade-www-deps' command." |
| 45 | + |
| 46 | +# Bump Javascript packages versions |
| 47 | + |
| 48 | +# Search all package.json files and bump the version |
| 49 | +# and exclude `package.json` in `node_modules` folder |
| 50 | +for package_json_file in $(find . -name package.json | grep -v "/node_modules/"); do |
| 51 | + folder="$(dirname $package_json_file)" |
| 52 | + pushd "$folder" || exit |
| 53 | + npm version patch |
| 54 | + popd || exit |
| 55 | +done |
| 56 | + |
| 57 | +pushd mithril-client-wasm || exit |
| 58 | +make www-install www-test-install |
| 59 | +popd || exit |
| 60 | + |
| 61 | +pushd mithril-explorer || exit |
| 62 | +make install |
| 63 | +popd || exit |
| 64 | + |
| 65 | +pushd docs/website || exit |
| 66 | +make install |
| 67 | +popd || exit |
| 68 | + |
| 69 | +git commit -am "chore: bump mithril client wasm 'www' and 'www-test' dependencies |
| 70 | +
|
| 71 | +By running: |
| 72 | +- 'make www-install' command in 'mithril-client-wasm'. |
| 73 | +- 'make www-test-install' command in 'mithril-client-wasm'. |
| 74 | +- 'make install' command in 'mithril-explorer'. |
| 75 | +- 'make install' command in 'docs/website'." |
| 76 | + |
| 77 | +# create a temporary script file that print "hello" |
| 78 | +TMP_SCRIPT_DIR=/tmp/mithril |
| 79 | +FLAKE_UPDATE_SCRIPT=nix_flake_update.sh |
| 80 | + |
| 81 | +mkdir -p "$TMP_SCRIPT_DIR" |
| 82 | +echo "git config --global --add safe.directory '*' |
| 83 | +nix --extra-experimental-features 'nix-command flakes' flake update" > "$TMP_SCRIPT_DIR/$FLAKE_UPDATE_SCRIPT" |
| 84 | + |
| 85 | +# The nix update is deactivated while waiting to be compatible with the latest version |
| 86 | +# # Upgrade Nix Flake dependencies |
| 87 | +# docker run -v "$(pwd)":/mithril -v "$TMP_SCRIPT_DIR":/scripts/mithril -w /mithril nixos/nix /bin/sh -c ". /scripts/mithril/$FLAKE_UPDATE_SCRIPT" |
| 88 | +# rm "$TMP_SCRIPT_DIR/$FLAKE_UPDATE_SCRIPT" |
| 89 | +# |
| 90 | +# git commit -am "chore: update nix flake dependencies |
| 91 | +# |
| 92 | +# By running 'nix flake update' command." |
0 commit comments