Skip to content

Commit

Permalink
add release script
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Jan 12, 2024
1 parent 022970a commit d0a8fca
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/aicirt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: AICIrt
on:
push:
branches: [ "main" ]
tags:
- "v*.*.*"
pull_request:
branches: [ "main" ]

Expand Down Expand Up @@ -35,3 +37,13 @@ jobs:
- name: Build aicirt
run: cargo build --verbose --release
working-directory: aicirt
- name: Release script
run: ./scripts/release.sh --xz
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: target/dist/README.md
files: |
target/dist/*.tar.gz
target/dist/*.tar.xz
74 changes: 74 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/sh

FOLDERS="aici_abi uppercase pyctrl jsctrl declctrl aicirt"
NATIVE="$(uname -s | tr 'A-Z' 'a-z')-$(uname -m)"
D=`date +%Y%m%d-%H%M`
TAG=`git describe --dirty --tags --match 'v[0-9]*' --always | sed -e 's/^v//; s/-dirty/-'"$D/"`
XZ=

if [ "$1" == "--xz" ] ; then
XZ=1
shift
fi

echo "Building for $NATIVE"

set -e

for f in $FOLDERS ; do
echo "Build $f..."
(cd $f && cargo build --release)
done

function release() {

T0=$1
T=target/dist/$1
shift

TITLE="$1"
shift

SUFF="$1"
shift

rm -rf $T
mkdir -p $T
echo "# $TITLE ($SUFF-$TAG)" > $T/README.md

BN=
for f in "$@" ; do
cp $f $T/
BN="$BN $(basename $f)"
done

echo >> $T/README.md
echo "Contents:" >> $T/README.md
echo '```' >> $T/README.md
(cd $T && ls -l $BN | awk '{print $5, $9}') >> $T/README.md
echo >> $T/README.md
(cd $T && sha256sum $BN) >> $T/README.md
echo '```' >> $T/README.md
echo >> $T/README.md

cat $T/README.md >> target/dist/README.md

if [ "$XZ" = "1" ] ; then
DST=target/dist/$T0-$SUFF-$TAG.tar.xz
tar -Jcf $DST -C target/dist $T0
ls -l $DST
fi

DST=target/dist/$T0-$SUFF-$TAG.tar.gz
tar -zcf $DST -C target/dist $T0
ls -l $DST

}

rm -rf target/dist
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 d0a8fca

Please sign in to comment.