diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..a89461c --- /dev/null +++ b/deploy.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# Tags a new version, builds the image with docker buildx, and publishes it +# to the Gitea container registry. +# +# Usage: ./deploy.sh [patch|minor|major|x.y.z] (default: patch) +# +# Requires: docker login git.gar.dev +set -euo pipefail + +IMAGE="git.gar.dev/georgesg/vertex" +PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}" +BUMP="${1:-patch}" + +cd "$(dirname "$0")" + +if [[ -n "$(git status --porcelain)" ]]; then + echo "error: working tree is not clean — commit or stash first" >&2 + exit 1 +fi + +# Bumps package.json, commits, and creates the vX.Y.Z git tag. +npm version "$BUMP" --message "Release %s" +VERSION="$(node -p "require('./package.json').version")" + +docker buildx build \ + --platform "$PLATFORMS" \ + --tag "$IMAGE:$VERSION" \ + --tag "$IMAGE:latest" \ + --push \ + . + +git push origin HEAD "v$VERSION" + +echo "published $IMAGE:$VERSION and $IMAGE:latest"