diff --git a/.gitignore b/.gitignore index fb4e296f..408b078b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ bot.db xdcs/* bot-data/* import/* -**/__pycache__/* \ No newline at end of file +**/__pycache__/* +dist/ diff --git a/frontend/create_xdc.sh b/frontend/create_xdc.sh index 57bd353a..4d61d5c0 100755 --- a/frontend/create_xdc.sh +++ b/frontend/create_xdc.sh @@ -1,5 +1,10 @@ #!/bin/sh -mkdir -p ../bot-data + +: "${DESTDIR:=$PWD/..}" + +DESTDIR="$DESTDIR/bot-data" + +mkdir -p "$DESTDIR" cd dist echo "Building appstore.xdc" @@ -7,7 +12,7 @@ cd shop mv shop.html index.html cp ../../build-files/shop/* . zip -9 --recurse-paths "appstore.xdc" * -cp appstore.xdc ../../../bot-data +cp appstore.xdc "$DESTDIR" cd .. echo "Building submit-helper.xdc" @@ -15,7 +20,7 @@ cd submit mv submit.html index.html cp ../../build-files/submit/* . zip -9 --recurse-paths "submit-helper.xdc" * -cp submit-helper.xdc ../../../bot-data +cp submit-helper.xdc "$DESTDIR" cd .. echo "Building review-helper.xdc" @@ -23,5 +28,5 @@ cd review mv review.html index.html cp ../../build-files/review/* . zip -9 --recurse-paths "review-helper.xdc" * -cp review-helper.xdc ../../../bot-data +cp review-helper.xdc "$DESTDIR" cd .. diff --git a/scripts/dist.sh b/scripts/dist.sh new file mode 100755 index 00000000..c0c53a44 --- /dev/null +++ b/scripts/dist.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Script to create the distribution tarball. +set -e + +SRC="$PWD" + +TMP="$(mktemp -d)" +export DESTDIR="$TMP/appstore-bot" +mkdir "$DESTDIR" + +# Build the frontend. +cd "$SRC/frontend" +npm run build + +# Build the backend. +cd "$SRC" +cargo build --release + +cp target/release/github-bot "$DESTDIR/appstore-bot" + +mkdir -p "$SRC/dist" +OUT="$SRC/dist/appstore-bot.tar.gz" +tar -C "$TMP" -czf "$OUT" appstore-bot + +echo Distribution tarball is built at $OUT >&2 + +rm -fr "$TMP"