From 853c3edf921747636e201db19e59a57fbbe5aa9a Mon Sep 17 00:00:00 2001 From: naturallaw777 <99053422+naturallaw777@users.noreply.github.com> Date: Wed, 29 Jul 2026 15:22:58 +0000 Subject: [PATCH 1/2] fix(scripts): auto-detect git remotes and clean up temp files in release-stable.sh Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com> --- scripts/release-stable.sh | 52 +++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/scripts/release-stable.sh b/scripts/release-stable.sh index 7c6807d..d02fb5c 100755 --- a/scripts/release-stable.sh +++ b/scripts/release-stable.sh @@ -29,11 +29,31 @@ CYAN='\033[0;36m' NC='\033[0m' # Configuration -GITEA_REMOTE="gitea" -GITHUB_REMOTE="origin" +GITEA_REMOTE_DEFAULT="gitea" +GITHUB_REMOTE_DEFAULT="origin" GITEA_API_URL="https://git.sovransystems.com/api/v1" CHANGELOG_FILE="CHANGELOG.md" +# Auto-detect remotes +detect_remote() { + local preferred="$1" + local keyword="$2" + if git remote | grep -q -x "$preferred"; then + echo "$preferred" + return + fi + local found + found=$(git remote -v | grep -i "$keyword" | head -n 1 | awk '{print $1}') + if [[ -n "$found" ]]; then + echo "$found" + return + fi + echo "$preferred" +} + +GITEA_REMOTE=$(detect_remote "$GITEA_REMOTE_DEFAULT" "sovransystems\|gitea") +GITHUB_REMOTE=$(detect_remote "$GITHUB_REMOTE_DEFAULT" "github") + echo -e "${BLUE}╔════════════════════════════════════════════════════════════╗${NC}" echo -e "${BLUE}║ Sovran_SystemsOS Automated Stable Release Script ║${NC}" echo -e "${BLUE}╚════════════════════════════════════════════════════════════╝${NC}" @@ -139,7 +159,11 @@ fi # ───────────────────────────────────────────────────────────────────────────── echo echo -e "${BLUE}Step 1: Pushing main → stable on Gitea...${NC}" -git push "${GITEA_REMOTE}" main:stable --force-with-lease +if git remote | grep -q -x "${GITEA_REMOTE}"; then + git push "${GITEA_REMOTE}" main:stable --force-with-lease || echo -e " ${YELLOW}⚠ Push to ${GITEA_REMOTE} failed.${NC}" +else + echo -e " ${YELLOW}⚠ Remote '${GITEA_REMOTE}' not found in git — skipping Gitea push.${NC}" +fi # ───────────────────────────────────────────────────────────────────────────── # Step 2: Create annotated tag @@ -149,9 +173,13 @@ echo -e "${BLUE}Step 2: Creating annotated tag ${TAG}...${NC}" git tag -a "${TAG}" -m "${RELEASE_MESSAGE} - Stable release of Sovran_SystemsOS -- See CHANGELOG.md for full details" +- See CHANGELOG.md for full details" || true -git push "${GITEA_REMOTE}" "${TAG}" +if git remote | grep -q -x "${GITEA_REMOTE}"; then + git push "${GITEA_REMOTE}" "${TAG}" || echo -e " ${YELLOW}⚠ Tag push to ${GITEA_REMOTE} failed.${NC}" +else + echo -e " ${YELLOW}⚠ Remote '${GITEA_REMOTE}' not found in git — skipping Gitea tag push.${NC}" +fi # Update VERSION file for ISO builds echo "${VERSION}" > VERSION @@ -199,6 +227,7 @@ if [ -f "$CHANGELOG_FILE" ]; then } { print } ' "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" && mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" + rm -f "${CHANGELOG_FILE}.bak" echo -e " ${GREEN}✓${NC} CHANGELOG.md updated with new section for ${TAG}" else @@ -217,9 +246,16 @@ else echo read -rp "Push the changelog commit to GitHub now? (y/N): " push_confirm if [[ "$push_confirm" =~ ^[Yy]$ ]]; then - echo -e "${BLUE}Pushing changelog commit...${NC}" - git push "${GITHUB_REMOTE}" main - echo -e " ${GREEN}✓${NC} Changelog pushed to GitHub" + if git remote | grep -q -x "${GITHUB_REMOTE}"; then + echo -e "${BLUE}Pushing changelog commit...${NC}" + if git push "${GITHUB_REMOTE}" main; then + echo -e " ${GREEN}✓${NC} Changelog pushed to GitHub (${GITHUB_REMOTE})" + else + echo -e " ${YELLOW}⚠ Push to GitHub failed — verify credentials or remote name.${NC}" + fi + else + echo -e " ${YELLOW}⚠ Remote '${GITHUB_REMOTE}' not found — skipping push to GitHub.${NC}" + fi else echo " (Changelog commit left local — remember to push later)" fi From e12e9ba01b7a28c6b231a6e0b3f1352a00bff333 Mon Sep 17 00:00:00 2001 From: naturallaw777 <99053422+naturallaw777@users.noreply.github.com> Date: Wed, 29 Jul 2026 15:28:50 +0000 Subject: [PATCH 2/2] fix(scripts): align release script with Gitea staging-dev and stable branch workflow Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com> --- scripts/release-stable.sh | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/scripts/release-stable.sh b/scripts/release-stable.sh index d02fb5c..32da184 100755 --- a/scripts/release-stable.sh +++ b/scripts/release-stable.sh @@ -155,12 +155,13 @@ if [[ ! "$confirm" =~ ^[Yy]$ ]]; then fi # ───────────────────────────────────────────────────────────────────────────── -# Step 1: Push main to stable +# Step 1: Push tested code to Gitea (stable & staging-dev) # ───────────────────────────────────────────────────────────────────────────── echo -echo -e "${BLUE}Step 1: Pushing main → stable on Gitea...${NC}" +echo -e "${BLUE}Step 1: Pushing tested code to Gitea (stable & staging-dev)...${NC}" if git remote | grep -q -x "${GITEA_REMOTE}"; then - git push "${GITEA_REMOTE}" main:stable --force-with-lease || echo -e " ${YELLOW}⚠ Push to ${GITEA_REMOTE} failed.${NC}" + git push "${GITEA_REMOTE}" HEAD:stable --force-with-lease || echo -e " ${YELLOW}⚠ Push to ${GITEA_REMOTE} (stable) failed.${NC}" + git push "${GITEA_REMOTE}" HEAD:staging-dev --force-with-lease || echo -e " ${YELLOW}⚠ Push to ${GITEA_REMOTE} (staging-dev) failed.${NC}" else echo -e " ${YELLOW}⚠ Remote '${GITEA_REMOTE}' not found in git — skipping Gitea push.${NC}" fi @@ -181,6 +182,10 @@ else echo -e " ${YELLOW}⚠ Remote '${GITEA_REMOTE}' not found in git — skipping Gitea tag push.${NC}" fi +if git remote | grep -q -x "${GITHUB_REMOTE}"; then + git push "${GITHUB_REMOTE}" "${TAG}" || echo -e " ${YELLOW}⚠ Tag push to ${GITHUB_REMOTE} failed.${NC}" +fi + # Update VERSION file for ISO builds echo "${VERSION}" > VERSION git add VERSION @@ -244,17 +249,23 @@ else # Ask if user wants to push echo - read -rp "Push the changelog commit to GitHub now? (y/N): " push_confirm + read -rp "Push the changelog commit to GitHub (main) and Gitea (staging-dev) now? (y/N): " push_confirm if [[ "$push_confirm" =~ ^[Yy]$ ]]; then if git remote | grep -q -x "${GITHUB_REMOTE}"; then - echo -e "${BLUE}Pushing changelog commit...${NC}" - if git push "${GITHUB_REMOTE}" main; then - echo -e " ${GREEN}✓${NC} Changelog pushed to GitHub (${GITHUB_REMOTE})" + echo -e "${BLUE}Pushing changelog commit to GitHub main...${NC}" + if git push "${GITHUB_REMOTE}" HEAD:main; then + echo -e " ${GREEN}✓${NC} Changelog pushed to GitHub main (${GITHUB_REMOTE})" else - echo -e " ${YELLOW}⚠ Push to GitHub failed — verify credentials or remote name.${NC}" + echo -e " ${YELLOW}⚠ Push to GitHub main failed — verify credentials or remote name.${NC}" + fi + fi + if git remote | grep -q -x "${GITEA_REMOTE}"; then + echo -e "${BLUE}Pushing changelog commit to Gitea staging-dev...${NC}" + if git push "${GITEA_REMOTE}" HEAD:staging-dev; then + echo -e " ${GREEN}✓${NC} Changelog pushed to Gitea staging-dev (${GITEA_REMOTE})" + else + echo -e " ${YELLOW}⚠ Push to Gitea staging-dev failed.${NC}" fi - else - echo -e " ${YELLOW}⚠ Remote '${GITHUB_REMOTE}' not found — skipping push to GitHub.${NC}" fi else echo " (Changelog commit left local — remember to push later)" @@ -332,7 +343,7 @@ echo -e "${GREEN}╚════════════════════ echo echo "Next manual steps (recommended):" echo " • Review and enhance the new section in CHANGELOG.md" -echo " • Push the changelog commit: git push origin main" +echo " • Push changes: git push ${GITHUB_REMOTE} HEAD:main && git push ${GITEA_REMOTE} HEAD:staging-dev" echo " • Verify releases on both GitHub and Gitea" echo echo -e "${CYAN}Tag created: ${TAG}${NC}"