Compare commits

...
2 Commits
+21 -11
View File
@@ -63,7 +63,12 @@ echo
# Helper: Get latest tag
# ─────────────────────────────────────────────────────────────────────────────
get_latest_tag() {
git tag --list 'v*' --sort=-version:refname | head -1 || echo ""
local exclude="${1:-}"
if [[ -n "$exclude" ]]; then
git tag --list 'v*' --sort=-version:refname | grep -v -x -E "v?${exclude#v}|${exclude}" | head -1 || echo ""
else
git tag --list 'v*' --sort=-version:refname | head -1 || echo ""
fi
}
# ─────────────────────────────────────────────────────────────────────────────
@@ -88,7 +93,7 @@ suggest_next_version() {
# Step 0: Fetch everything
# ─────────────────────────────────────────────────────────────────────────────
echo -e "${BLUE}Step 0: Fetching latest from all remotes...${NC}"
git fetch --all --tags --prune --force || git fetch --all --tags --prune --force 2>/dev/null || true
git fetch --all --tags 2>/dev/null || true
LATEST_TAG=$(get_latest_tag)
NEXT_VERSION=$(suggest_next_version "$LATEST_TAG")
@@ -188,9 +193,10 @@ generate_release_notes() {
printf '%s' "$notes"
}
# Build the notes from commits since the previous tag
if [[ -n "$LATEST_TAG" ]] && git rev-parse -q --verify "$LATEST_TAG" >/dev/null; then
COMMIT_RANGE="${LATEST_TAG}..HEAD"
# Build the notes from commits since the previous tag (exclude the target tag if already present)
PREV_TAG=$(get_latest_tag "$TAG")
if [[ -n "$PREV_TAG" ]] && git rev-parse -q --verify "$PREV_TAG" >/dev/null; then
COMMIT_RANGE="${PREV_TAG}..HEAD"
else
COMMIT_RANGE="HEAD"
fi
@@ -256,7 +262,7 @@ fi
# ─────────────────────────────────────────────────────────────────────────────
echo
echo -e "${BLUE}Step 2: Creating annotated tag ${TAG}...${NC}"
git tag -a "${TAG}" -m "${RELEASE_MESSAGE}
git tag -f -a "${TAG}" -m "${RELEASE_MESSAGE}
- Stable release of Sovran_SystemsOS
- See CHANGELOG.md for full details" || true
@@ -356,17 +362,18 @@ echo
echo -e "${BLUE}Step 4: Creating GitHub Release...${NC}"
if command -v gh &>/dev/null; then
title_suffix="${RELEASE_MESSAGE#Sovran_SystemsOS v* — }"
title_suffix="${title_suffix#Sovran_SystemsOS * — }"
if gh release create "${TAG}" \
--repo naturallaw777/Sovran_SystemsOS \
--title "${TAG} — ${RELEASE_MESSAGE#Sovran_SystemsOS v* — }" \
--notes-file "${NOTES_FILE}" \
--target main 2>/dev/null; then
--title "${TAG} — ${title_suffix}" \
--notes-file "${NOTES_FILE}"; then
echo -e " ${GREEN}✓${NC} GitHub release created successfully"
else
echo -e " ${YELLOW}⚠${NC} GitHub release may already exist or failed"
echo -e " ${YELLOW}⚠${NC} GitHub release creation failed (check 'gh auth status' or create via web GUI)"
fi
else
echo -e " ${YELLOW}⚠${NC} gh CLI not found — skipping GitHub release"
echo -e " ${YELLOW}⚠${NC} gh CLI not found — skipping GitHub release (create via GitHub web GUI)"
fi
# ─────────────────────────────────────────────────────────────────────────────
@@ -409,6 +416,9 @@ if [[ -n "${GITEA_TOKEN:-}" ]]; then
if echo "$RESPONSE" | grep -q '"id"'; then
echo -e " ${GREEN}✓${NC} Gitea release created successfully"
elif echo "$RESPONSE" | grep -q "write:repository"; then
echo -e " ${YELLOW}⚠${NC} Gitea token scope issue: your token requires the 'write:repository' scope (currently has write:package)."
echo " To fix: In Gitea, navigate to Settings → Applications → Manage Access Tokens and generate a token with 'write:repository'."
else
echo -e " ${YELLOW}⚠${NC} Gitea release creation failed or already exists"
echo " Response: $RESPONSE"