feat(builtin-package): use new blueprint (#94)

This commit is contained in:
Aleksey Proshutisnkiy 2023-05-08 17:48:39 +04:00 committed by GitHub
parent d567848cba
commit a747b9cc75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 11 deletions

View File

@ -105,6 +105,9 @@ jobs:
run: npm publish --access public
working-directory: aqua
- name: Install ipfs
uses: nahsi/setup-ipfs@v1
- name: Create builtin distribution package
if: needs.release-please.outputs.trust-graph-release-created
run: ./builtin-package/package.sh

View File

@ -58,6 +58,9 @@ jobs:
- run: npm run build
working-directory: aqua
- name: Install ipfs
uses: nahsi/setup-ipfs@v1
- name: Create distribution package
run: ./builtin-package/package.sh

View File

@ -1,7 +0,0 @@
{
"name": "trust-graph",
"dependencies": [
"name:sqlite3",
"name:trust-graph"
]
}

View File

@ -3,18 +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)/../package"
(
rm -f $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"
)
TRUST_GRAPH_CID=$(ipfs add -q --only-hash --cid-version=1 --chunker=size-262144 $PACKAGE_DIR/trust-graph.wasm)
SQLITE_CID=$(ipfs add -q --only-hash --cid-version=1 --chunker=size-262144 $PACKAGE_DIR/sqlite3.wasm)
mv $PACKAGE_DIR/trust-graph.wasm "$PACKAGE_DIR"/"$TRUST_GRAPH_CID".wasm
mv $PACKAGE_DIR/sqlite3.wasm "$PACKAGE_DIR"/"$SQLITE_CID".wasm
cp trust-graph_config.json "$PACKAGE_DIR"/"$TRUST_GRAPH_CID"_config.json
cp sqlite3_config.json "$PACKAGE_DIR"/"$SQLITE_CID"_config.json
# write blueprint.json
echo "{}" | jq --arg trust_graph_cid "$TRUST_GRAPH_CID" --arg sqlite_cid "$SQLITE_CID" '{"name": "trust-graph", "dependencies":[{"/":$sqlite_cid},{"/":$trust_graph_cid}]}' > "$PACKAGE_DIR/blueprint.json"
(
echo "*** create builtin distribution package ***"
cd ..
tar --exclude="package.sh" -f trust-graph.tar.gz -zcv --transform 's|builtin-package|trust-graph|' builtin-package
cd $PACKAGE_DIR
(tar cf - * | gzip) > ../trust-graph.tar.gz
)
echo "*** done ***"