diff --git a/bin/deploy.sh b/bin/deploy.sh new file mode 100755 index 0000000..9d20cad --- /dev/null +++ b/bin/deploy.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +set -euo pipefail + +deploy_branch="${1:-deploy}" +current_branch="$(git rev-parse --abbrev-ref HEAD)" + +if ! git diff --quiet || ! git diff --cached --quiet; then + echo "Working tree is not clean. Commit or stash changes before deploy." + exit 1 +fi + +cleanup() { + git checkout "${current_branch}" >/dev/null 2>&1 || true +} +trap cleanup EXIT + +git checkout "${deploy_branch}" +git merge --no-edit "${current_branch}" +git push explorer.specnext.dev "${deploy_branch}" diff --git a/package.json b/package.json index 84dc229..9319232 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,8 @@ "build": "next build --turbopack", "start": "next start", "lint": "eslint", + "deploy": "bin/deploy.sh", + "deploy:branch": "bin/deploy.sh", "deploy-prod": "git push --set-upstream explorer.specnext.dev deploy", "deploy-test": "git push --set-upstream test.explorer.specnext.dev test" }, diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 79efc22..ee4dcf5 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -14,7 +14,7 @@ export default function NavbarClient() { @@ -22,4 +22,4 @@ export default function NavbarClient() { ); -} \ No newline at end of file +}