24 lines
979 B
Bash
Executable File
24 lines
979 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
VERSION="${1:?version required, e.g. V1R1C0}"
|
|
MESSAGE="${2:-release $VERSION}"
|
|
if ! echo "$VERSION" | grep -Eq '^V[0-9]+R[0-9]+C[0-9]+$'; then echo "ERROR: version must match VxRxCx"; exit 1; fi
|
|
cd "${AIOS_GITOPS_WORKSPACE:-/data/aios-gitops/workspace}"
|
|
git checkout main
|
|
git pull origin main || true
|
|
git tag -a "$VERSION" -m "$MESSAGE" || true
|
|
git push origin "$VERSION" || true
|
|
python3 - <<PY
|
|
import json, datetime
|
|
from pathlib import Path
|
|
p=Path('baseline/current.json')
|
|
if p.exists(): d=json.loads(p.read_text())
|
|
else: p.parent.mkdir(exist_ok=True); d={}
|
|
d['active_version']='$VERSION'; d['active_tag']='$VERSION'; d['updated_at']=datetime.datetime.now(datetime.UTC).isoformat(); d['update_mode']='git_patch_only'
|
|
p.write_text(json.dumps(d, ensure_ascii=False, indent=2))
|
|
PY
|
|
git add baseline/current.json || true
|
|
git commit -m "release($VERSION): update active baseline" || true
|
|
git push origin main || true
|
|
echo "RELEASE_DONE $VERSION"
|