diff --git a/scripts/update-gitea-local-fork.sh b/scripts/update-gitea-local-fork.sh index 4328c50..e0142b0 100755 --- a/scripts/update-gitea-local-fork.sh +++ b/scripts/update-gitea-local-fork.sh @@ -29,15 +29,15 @@ log() { printf '\033[1;36m==>\033[0m %s\n' "$*"; } # ── 0. Wipe prior unstable tags from gitea fork ─────────────────────────── cd "$GITEA_REPO" log "Cleaning up previous unstable tags on gitea fork (so nix-update sees only clean semver tags)" -mapfile -t PREV_TAGS < <(git ls-remote --tags oleks 'refs/tags/v*-unstable-*' \ - | awk '{print $2}' \ - | sed 's|refs/tags/||;s|\^{}$||' \ - | sort -u) +mapfile -t PREV_TAGS < <(git ls-remote --tags oleks 'refs/tags/v*-unstable-*' | + awk '{print $2}' | + sed 's|refs/tags/||;s|\^{}$||' | + sort -u) for tag in "${PREV_TAGS[@]}"; do - [ -z "$tag" ] && continue - log " deleting $tag" - git tag -d "$tag" 2>/dev/null || true - git push oleks ":refs/tags/$tag" 2>/dev/null || true + [ -z "$tag" ] && continue + log " deleting $tag" + git tag -d "$tag" 2>/dev/null || true + git push oleks ":refs/tags/$tag" 2>/dev/null || true done # ── 1. nix-update default flow ──────────────────────────────────────────── @@ -49,9 +49,9 @@ sed -i -E 's/(version = "[^"]+?)-unstable-[0-9]{4}-[0-9]{2}-[0-9]{2}"/\1"/' "$PK log "Running nix-update against oleks/main tip on the gitea fork" nix run nixpkgs#nix-update -- \ - --flake gitea-local-fork \ - --version=branch=main \ - --build + --flake gitea-local-fork \ + --version=branch=main \ + --build # ── 2. Tag gitea fork ───────────────────────────────────────────────────── NEW_REV=$(grep -oP 'rev = "\K[a-f0-9]{40}' "$PKG_FILE" | head -1) @@ -61,11 +61,11 @@ log "New version: $NEW_VER (rev ${NEW_REV:0:12})" cd "$GITEA_REPO" if git rev-parse --verify --quiet "refs/tags/$TAG" >/dev/null; then - log "Tag $TAG already exists locally — skipping" + log "Tag $TAG already exists locally — skipping" else - log "Tagging gitea fork: $TAG at ${NEW_REV:0:12}" - git -c commit.gpgsign=false tag -a "$TAG" "$NEW_REV" \ - -m "Pinned by nix-customs/flake-hub gitea-local-fork derivation" + log "Tagging gitea fork: $TAG at ${NEW_REV:0:12}" + git -c commit.gpgsign=false tag -a "$TAG" "$NEW_REV" \ + -m "Pinned by nix-customs/flake-hub gitea-local-fork derivation" fi log "Pushing tag to oleks remote" git push oleks "$TAG" 2>/dev/null || log " tag already on remote" @@ -73,21 +73,21 @@ git push oleks "$TAG" 2>/dev/null || log " tag already on remote" # ── 3. Commit + push flake-hub changes ──────────────────────────────────── cd "$FLAKE_HUB" if git diff --quiet -- "$PKG_FILE"; then - log "flake-hub: no changes to commit" + log "flake-hub: no changes to commit" else - log "flake-hub: committing version + hashes bump" - git -c commit.gpgsign=false add "$PKG_FILE" - git -c commit.gpgsign=false commit -m "gitea-local-fork: refresh to $NEW_VER + log "flake-hub: committing version + hashes bump" + git -c commit.gpgsign=false add "$PKG_FILE" + git -c commit.gpgsign=false commit -m "gitea-local-fork: refresh to $NEW_VER Pin to gitea fork rev ${NEW_REV:0:12} (tag $TAG). Refreshed by nix-update via passthru.updateScript." fi if git rev-parse '@{u}' >/dev/null 2>&1; then - log "flake-hub: pushing" - git push + log "flake-hub: pushing" + git push else - log "flake-hub: no upstream tracking — skipping push" + log "flake-hub: no upstream tracking — skipping push" fi log "Done. New version $NEW_VER live at:"