Skip to content

Commit 8cd9805

Browse files
committed
CI: fix tag creation — use per-repo branches, skip existing tags
1 parent 3fc4347 commit 8cd9805

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

.github/workflows/build-and-publish.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,28 @@ jobs:
122122
VERSION: ${{ steps.bump.outputs.version }}
123123
run: |
124124
set -e
125-
REPOS=(
126-
"localpibox/pi"
127-
"localpibox/pi-subagents"
128-
"localpibox/lemonade-pi-plugin"
129-
"localpibox/config"
130-
"localpibox/lpb-memory"
125+
# repo -> default branch mapping
126+
declare -A REPO_BRANCHS=(
127+
["localpibox/pi"]="lpb-dev"
128+
["localpibox/pi-subagents"]="lpb-dev"
129+
["localpibox/lemonade-pi-plugin"]="lpb-dev"
130+
["localpibox/config"]="dev"
131+
["localpibox/lpb-memory"]="dev"
131132
)
132-
for repo in "${REPOS[@]}"; do
133-
echo "Tagging $repo@$VERSION"
134-
gh api repos/$repo/git/refs/tags \
135-
--method POST \
136-
-f ref="refs/tags/$VERSION" \
137-
-f sha="$(git rev-parse origin/lpb-dev 2>/dev/null || git rev-parse origin/dev 2>/dev/null || git rev-parse HEAD)" \
138-
--jq '.message' 2>/dev/null || true
133+
for repo in "${!REPO_BRANCHS[@]}"; do
134+
branch="${REPO_BRANCHS[$repo]}"
135+
echo "Tagging $repo@$VERSION (from $branch)"
136+
sha=$(git ls-remote "https://github.com/$repo.git" "refs/heads/$branch" | awk '{print $1}')
137+
if [ -n "$sha" ]; then
138+
gh api repos/$repo/git/refs/tags \
139+
--method POST \
140+
-f ref="refs/tags/$VERSION" \
141+
-f sha="$sha" \
142+
2>/dev/null && echo " ✅ $repo@$VERSION" || echo " ⚠️ $repo tag skipped (may exist)"
143+
else
144+
echo " ⚠️ $repo:$branch not found, skipping tag"
145+
fi
139146
done
140-
echo "✅ Tags created on all 5 repos"
141147
142148
# ──────────────────────────────────────────────────────
143149
# Phase 3: Build & publish images

0 commit comments

Comments
 (0)