allegro/scripts/release.sh

29 lines
882 B
Bash
Executable file

#!/usr/bin/env bash
# Builds the final versions of the book and then upload the results to various
# locations.
# Move into the root folder.
cd $(dirname $(dirname $0))
# Perform the basic environment checks and setup.
./scripts/setup.sh || exit 1
./scripts/check-env-bucket.sh || exit 1
# Clean up old versions of the file.
rm -f dmoonfire*
# Perform the release process.
npx semantic-release
# Create a tarball of the output files and upload them to S3.
if ls dmoonfire* &> /dev/null
then
export npm_package_name=$(cat package.json | jq -r .name)
tar -cjf $npm_package_name.tar.bz2 dmoonfire*
s3cmd --access_key=$AWS_ACCESS_KEY_ID --access_token=$AWS_SECRET_ACCESS_KEY --host=$AWS_ENDPOINT --host-bucket=$AWS_ENDPOINT -P put allegro.tar.bz2 s3://$AWS_BUCKET
fi
# Versions
# 2022-08-12 Added an if check for files before uploading
# 2022-08-11 - Initial version