Skip to content

Commit

Permalink
add tag.sh script in controller release
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Jan 12, 2024
1 parent 40b83d2 commit 2dd3375
Showing 1 changed file with 71 additions and 1 deletion.
72 changes: 71 additions & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
#!/bin/bash
VERSION="$TAG"
MODULES="$(echo $WASM)"
EOF
cat >> $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
Expand All @@ -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
Expand All @@ -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

0 comments on commit 2dd3375

Please sign in to comment.