Add features
This commit is contained in:
76
scripts/build.sh
Executable file
76
scripts/build.sh
Executable file
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get version from package.json.
|
||||
VERSION=$(node -p -e "require('./package.json').version")
|
||||
|
||||
# Set alias to latest if branch is main, dev if develop, or commit hash if others.
|
||||
if [ "$(git branch --show-current)" == "main" ]; then
|
||||
# Check if the working directory is clean.
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "Working directory is not clean. Commit changes before releasing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the local main branch is up-to-date with the remote main branch.
|
||||
git fetch
|
||||
if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/main)" ]; then
|
||||
echo "Local main branch is not up-to-date with the remote main branch. Push changes before releasing."
|
||||
exit 1
|
||||
fi
|
||||
elif [ "$(git branch --show-current)" == "develop" ]; then
|
||||
# Check if the working directory is clean.
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "Working directory is not clean. Commit changes before releasing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the local main branch is up-to-date with the remote main branch.
|
||||
git fetch
|
||||
if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/develop)" ]; then
|
||||
echo "Local main branch is not up-to-date with the remote main branch. Push changes before releasing."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
VERSION=$(git rev-parse --short HEAD)
|
||||
fi
|
||||
|
||||
# Set tags.
|
||||
TAGS=(
|
||||
"3t.network/butlerbot:$VERSION"
|
||||
"git.3t.network/3t.network/butlerbot:$VERSION"
|
||||
)
|
||||
|
||||
# Append to tags if the branch is main or develop.
|
||||
if [ "$ALIAS" == "latest" ]; then
|
||||
TAGS+=("3t.network/butlerbot:latest")
|
||||
TAGS+=("git.3t.network/3t.network/butlerbot:latest")
|
||||
elif [ "$ALIAS" == "dev" ]; then
|
||||
TAGS+=("3t.network/butlerbot:dev")
|
||||
TAGS+=("git.3t.network/3t.network/butlerbot:dev")
|
||||
fi
|
||||
|
||||
# cd to the project root directory.
|
||||
cd "$(dirname "$0")/.."
|
||||
docker build -t butlerbot:$VERSION .
|
||||
|
||||
# Tag the Docker image.
|
||||
for TAG in "${TAGS[@]}"; do
|
||||
docker tag butlerbot:$VERSION "$TAG"
|
||||
done
|
||||
|
||||
# Create docker-compose.override.yml with the version.
|
||||
cat > docker-compose.override.yml <<EOF
|
||||
services:
|
||||
butlerbot:
|
||||
image: git.3t.network/3t.network/butlerbot:$VERSION
|
||||
EOF
|
||||
|
||||
echo "docker-compose.override.yml created."
|
||||
|
||||
# Print build information.
|
||||
echo "butlerbot:$VERSION built successfully."
|
||||
echo "Tags:"
|
||||
for TAG in "${TAGS[@]}"; do
|
||||
echo " $TAG"
|
||||
done
|
||||
echo "Run 'docker compose up' to start the bot."
|
||||
3
scripts/register-slash-commands.sh
Executable file
3
scripts/register-slash-commands.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker compose run --rm butlerbot register-slash-commands
|
||||
3
scripts/start.sh
Executable file
3
scripts/start.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker compose up
|
||||
Reference in New Issue
Block a user