From 2dd33753ef6c8469135685de4d64f12bc44ea3c8 Mon Sep 17 00:00:00 2001 From: Michal Moskal Date: Fri, 12 Jan 2024 21:59:51 +0000 Subject: [PATCH] add tag.sh script in controller release --- scripts/release.sh | 72 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/scripts/release.sh b/scripts/release.sh index 3271ffe9..05754840 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -42,6 +42,58 @@ for f in "$@" ; do BN="$BN $(basename $f)" done +if [ "$SUFF" = "wasm32-wasi" ] ; then + WASM= + for B in $BN ; do + case $B in + aici_*.wasm) + WASM="$WASM $(basename $B .wasm | sed -e 's/aici_//; s/uppercase//')" + ;; + esac + done + cat > $T/tag.sh <> $T/tag.sh <<'EOF' +set -e +LATEST=0 +PREFIX= +: ${AICI:=aici} +if [ "$1" == "--latest" ] ; then + LATEST=1 + shift +fi +if [ "$1" != "" ] ; then + PREFIX="$1" + shift +fi +case "$PREFIX" in + -*) + echo "Usage: $0 [--latest] [prefix]" + exit 1 + ;; +esac + +echo "Tagging aici=$AICI prefix=$PREFIX latest=$LATEST version=$VERSION ..." +for M in $MODULES ; do + TAG_PREF="$PREFIX$M" + TAG="--tag $TAG_PREF-v$VERSION" + if [ "$LATEST" = "1" ] ; then + TAG="$TAG --tag $TAG_PREF-latest" + fi + echo "Tagging $M $TAG ..." + $AICI upload aici_$M.wasm $TAG +done +EOF + chmod +x $T/tag.sh + BN="$BN tag.sh" +else + (cd $T && strip $BN) +fi + + echo >> $T/README.md echo "Contents:" >> $T/README.md echo '```' >> $T/README.md @@ -51,6 +103,25 @@ echo >> $T/README.md echo '```' >> $T/README.md echo >> $T/README.md +if [ "$SUFF" = "wasm32-wasi" ] ; then + cat >> $T/README.md <<'EOF' +## Tagging + +You can upload and tag the modules using the `tag.sh` script. + +``` +Usage: ./tag.sh [--latest] [prefix] +``` + +The `--latest` option will also tag the module with the `controller-latest` tag, +while the `prefix` will be prepended to the module name when tagging. + +This requires `aici` command to be in path and AICI_API_BASE variable set. + + +EOF +fi + cat $T/README.md >> target/dist/README.md if [ "$XZ" = "1" ] ; then @@ -70,5 +141,4 @@ mkdir -p target/dist echo -n > target/dist/README.md release aici-controllers "AICI Controllers" "wasm32-wasi" target/wasm32-wasi/release/*.wasm -strip target/release/aicirt release aicirt "AICI Runtime" "$NATIVE" target/release/aicirt