diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7860ea5..393a9b1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -117,7 +117,7 @@ jobs: - name: Setup Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 - + - name: Install cargo-workspaces uses: baptiste0928/cargo-install@v2.0.0 with: @@ -161,6 +161,9 @@ jobs: --yes continue-on-error: true + - name: Install ipfs + uses: nahsi/setup-ipfs@v1 + - name: Create builtin distribution package run: ./builtin-package/package.sh diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5017a48..9f06829 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -58,6 +58,9 @@ jobs: NEXTEST_TEST_THREADS: 10 run: cargo nextest run --release --all-features --no-fail-fast + - name: Install ipfs + uses: nahsi/setup-ipfs@v1 + - name: Create distribution package run: ./builtin-package/package.sh diff --git a/builtin-package/blueprint.json b/builtin-package/blueprint.json deleted file mode 100644 index f4bb030..0000000 --- a/builtin-package/blueprint.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "ipfs", - "dependencies": [ - "name:ipfs_effector", - "name:ipfs_pure" - ] -} \ No newline at end of file diff --git a/builtin-package/package.sh b/builtin-package/package.sh index c630b40..d670375 100755 --- a/builtin-package/package.sh +++ b/builtin-package/package.sh @@ -3,21 +3,39 @@ set -o pipefail -o nounset -o errexit # set current working directory to script directory to run script from everywhere cd "$(dirname "$0")" -SCRIPT_DIR="$(pwd)" +PACKAGE_DIR="$(pwd)/../aqua-ipfs" + +( + rm -rf $PACKAGE_DIR/* + mkdir -p $PACKAGE_DIR +) ( echo "*** copy wasm files ***" cd ../service - cp artifacts/*.wasm "$SCRIPT_DIR" + cp artifacts/*.wasm "$PACKAGE_DIR" ) +( + echo "*** copy on_start script ***" + cp on_start.json "$PACKAGE_DIR" + cp on_start.air "$PACKAGE_DIR" +) + +PURE_CID=$(ipfs add -q --only-hash --cid-version=1 --chunker=size-262144 $PACKAGE_DIR/ipfs_pure.wasm) +EFFECTOR_CID=$(ipfs add -q --only-hash --cid-version=1 --chunker=size-262144 $PACKAGE_DIR/ipfs_effector.wasm) +mv $PACKAGE_DIR/ipfs_pure.wasm "$PACKAGE_DIR"/"$PURE_CID".wasm +mv $PACKAGE_DIR/ipfs_effector.wasm "$PACKAGE_DIR"/"$EFFECTOR_CID".wasm +cp ipfs_pure_config.json "$PACKAGE_DIR"/"$PURE_CID"_config.json +cp ipfs_effector_config.json "$PACKAGE_DIR"/"$EFFECTOR_CID"_config.json + +# write blueprint.json +echo "{}" | jq --arg pure_cid "$PURE_CID" --arg effector_cid "$EFFECTOR_CID" '{"name": "ipfs_pure", "dependencies":[{"/":$effector_cid},{"/":$pure_cid}]}' > "$PACKAGE_DIR/blueprint.json" + ( echo "*** create builtin distribution package ***" cd .. - mv builtin-package aqua-ipfs - tar --exclude="package.sh" -f aqua-ipfs.tar.gz -zcvv ./aqua-ipfs - mv aqua-ipfs builtin-package - echo "*** package created ***" + tar -f aqua-ipfs.tar.gz -zcvv ./aqua-ipfs ) echo "*** done ***"