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