From 14e323200c242edd932f05e5c94f039f8e0aa2a1 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Mon, 9 Feb 2026 11:55:14 -0500 Subject: [PATCH] fix: use dynamic repo URLs in metadata update step The metadata update step was hardcoded to push to the stable repo, causing dev releases to pollute the stable repo's main branch. Changes: - Use ${GITHUB_REPO} in archive-url instead of hardcoded stable repo - Use ${GITHUB_REPO} in git remote instead of hardcoded stable repo - Determine GITEA_BRANCH dynamically (dev/namespace-drawer for dev, main for stable) - Push the correct Gitea branch to GitHub main branch - Use temp branch to avoid conflicts Now dev releases only touch the dev repo, and stable releases only touch the stable repo. --- .gitea/workflows/release.yaml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index ca7f00d..b153b98 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -163,15 +163,21 @@ jobs: VERSION=${GITHUB_REF_NAME#v} git config user.name "gitea-actions[bot]" git config user.email "gitea-actions[bot]@git.farh.net" - git fetch origin main - git checkout origin/main -B main + # Determine which Gitea branch to update based on version suffix + if [[ "$VERSION" == *"-dev."* ]]; then + GITEA_BRANCH="dev/namespace-drawer" + else + GITEA_BRANCH="main" + fi + git fetch origin ${GITEA_BRANCH} + git checkout origin/${GITEA_BRANCH} -B temp-update sed -i "s|headlamp/plugin/archive-checksum:.*|headlamp/plugin/archive-checksum: sha256:${CHECKSUM}|" artifacthub-pkg.yml - sed -i "s|headlamp/plugin/archive-url:.*|headlamp/plugin/archive-url: \"https://github.com/cpfarhood/headlamp-polaris-plugin/releases/download/${GITHUB_REF_NAME}/headlamp-polaris-plugin-${VERSION}.tar.gz\"|" artifacthub-pkg.yml + sed -i "s|headlamp/plugin/archive-url:.*|headlamp/plugin/archive-url: \"https://github.com/${GITHUB_REPO}/releases/download/${GITHUB_REF_NAME}/headlamp-polaris-plugin-${VERSION}.tar.gz\"|" artifacthub-pkg.yml sed -i "s|^version:.*|version: ${VERSION}|" artifacthub-pkg.yml git add artifacthub-pkg.yml git diff --cached --quiet || { git commit -m "ci: update artifact hub metadata for ${GITHUB_REF_NAME}" - git push origin main + git push origin temp-update:${GITEA_BRANCH} } # Force-move tag to the commit with correct checksum. # This triggers a new CI run, but the guard step will detect @@ -179,7 +185,8 @@ jobs: git tag -f ${GITHUB_REF_NAME} git push -f origin ${GITHUB_REF_NAME} # Also push to GitHub directly to avoid waiting for mirror sync - git remote add github https://x-access-token:${{ secrets.GH_PAT }}@github.com/cpfarhood/headlamp-polaris-plugin.git 2>/dev/null || true - git push github main 2>/dev/null || true + # Dev versions go to main branch of dev repo, stable versions to main of main repo + git remote add github https://x-access-token:${{ secrets.GH_PAT }}@github.com/${GITHUB_REPO}.git 2>/dev/null || true + git push github temp-update:main 2>/dev/null || true git push -f github ${GITHUB_REF_NAME} 2>/dev/null || true echo "Tag ${GITHUB_REF_NAME} aligned with updated metadata"