Files
menu/deploy.sh
T
tanshu 0667110886 Lint with oxlint instead of ESLint
ESLint cannot parse this project's TypeScript: typescript@7 is the native port
with no JavaScript compiler API, which every ESLint TypeScript parser needs, and
typescript-eslint refuses to install with a >=4.8.4 <6.1.0 peer. oxlint parses
TypeScript without the compiler API, so it lints the .ts and the .js together in
about 20ms over the whole repo, and it runs the correctness category as errors.

It found one real thing on the first run: the drag harness built its fetch
options with a body key even for GET. The four opinionated rules it also flagged
are off with their reasoning in the README, since oxlint's config takes no
comments. lint is back in deploy.sh's checks, and the editor has lint tasks and
the oxc extension recommendation. Prettier is unchanged.
2026-09-22 23:21:19 +05:30

47 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Builds the image with podman, pushes it to the private registry, then deploys
# the Site with the playbook that lives in ansible/.
#
# ./deploy.sh 2026-09-22 deploy the default Site
# SITE=greatbear ./deploy.sh 2026-09-22 deploy another Site
# SKIP_DEPLOY=1 ./deploy.sh 2026-09-22 build and push only
# SKIP_CHECKS=1 ./deploy.sh 2026-09-22 skip format, typecheck and tests
#
set -euo pipefail
TAG="${1:-}"
if [[ -z "$TAG" ]]; then
echo "usage: $0 <tag> (e.g. $(date +%Y-%m-%d) or a git short sha)" >&2
exit 1
fi
parent_path=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
cd "$parent_path"
if ! command -v podman >/dev/null 2>&1; then
echo "podman is required to build and push the image" >&2
exit 1
fi
if [[ -z "${SKIP_CHECKS:-}" ]]; then
echo "==> lint, format, types and tests"
npm run lint
npm run format:check
npm run typecheck
npm test
fi
echo "==> building and pushing registry.tanshu.com/menu-admin:$TAG"
make build-production TAG="$TAG"
if [[ -n "${SKIP_DEPLOY:-}" ]]; then
echo "SKIP_DEPLOY is set, so the playbook was not run."
exit 0
fi
SITE="${SITE:-hopsngrains}"
echo "==> deploying $SITE"
cd ansible
ansible-playbook --inventory=hosts playbook.yml --limit "$SITE" -e "tag=$TAG"