Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
dc4c5fdf8a
|
|||
|
96eb3e8185
|
|||
|
37bf443e29
|
|||
|
f53dfa1c4c
|
@@ -53,37 +53,6 @@ jobs:
|
||||
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
GITEA_API_URL: http://gitea:3000/api/v1
|
||||
|
||||
# GoReleaser publishes to exactly one SCM (Gitea). The push mirror
|
||||
# carries git refs but not release artifacts, so relay the release to
|
||||
# the GitHub mirror — README install links point there.
|
||||
- name: Mirror release to GitHub
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_MIRROR_TOKEN }}
|
||||
run: |
|
||||
if [ -z "$GH_TOKEN" ]; then
|
||||
echo "GH_MIRROR_TOKEN not set — skipping GitHub release relay"
|
||||
exit 0
|
||||
fi
|
||||
apk add --no-cache github-cli
|
||||
TAG="${{ github.ref_name }}"
|
||||
|
||||
# Nudge the push mirror, then wait for the tag to land on GitHub.
|
||||
curl -sf -X POST \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||
"http://gitea:3000/api/v1/repos/lerkolabs/uptop/push_mirrors-sync" || true
|
||||
for i in $(seq 1 30); do
|
||||
if gh api "repos/lerkolabs/uptop/git/ref/tags/${TAG}" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 10
|
||||
done
|
||||
|
||||
PRERELEASE=""
|
||||
case "$TAG" in *-*) PRERELEASE="--prerelease";; esac
|
||||
gh release create "$TAG" \
|
||||
--repo lerkolabs/uptop \
|
||||
--verify-tag \
|
||||
--title "$TAG" \
|
||||
--notes-file /tmp/release-notes.md \
|
||||
$PRERELEASE \
|
||||
dist/*.tar.gz dist/*.zip dist/*.deb dist/*.rpm dist/checksums.txt
|
||||
# GitHub release relaying is handled by .github/workflows/mirror-release.yml,
|
||||
# which runs on GitHub Actions when the push mirror delivers the tag and
|
||||
# copies this run's Gitea release assets — no PAT needed on this side.
|
||||
|
||||
@@ -35,8 +35,12 @@ jobs:
|
||||
|
||||
TAGS="lerkolabs/uptop:${TAG}"
|
||||
TAGS="${TAGS},lerkolabs/uptop:sha-${SHORT_SHA}"
|
||||
# :latest only for real releases — rc rehearsal tags must not move it
|
||||
if [ "${{ github.ref_type }}" = "tag" ]; then
|
||||
TAGS="${TAGS},lerkolabs/uptop:latest"
|
||||
case "$TAG" in
|
||||
*-*) ;;
|
||||
*) TAGS="${TAGS},lerkolabs/uptop:latest" ;;
|
||||
esac
|
||||
fi
|
||||
echo "tags=$TAGS" >> "$GITHUB_OUTPUT"
|
||||
|
||||
@@ -52,6 +56,26 @@ jobs:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
# Scan must gate the push: build amd64 locally, scan it, and only then run
|
||||
# the multi-arch push (amd64 layers come from the builder cache, so the
|
||||
# second build only adds the arm64 work).
|
||||
- name: Build for scan (amd64, local)
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
load: true
|
||||
platforms: linux/amd64
|
||||
tags: uptop-scan:${{ steps.meta.outputs.tag }}
|
||||
build-args: |
|
||||
VERSION=${{ steps.meta.outputs.tag }}
|
||||
COMMIT=${{ github.sha }}
|
||||
BUILD_DATE=${{ github.event.head_commit.timestamp }}
|
||||
|
||||
- name: Scan image for CVEs
|
||||
run: |
|
||||
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.114.0
|
||||
grype uptop-scan:${{ steps.meta.outputs.tag }} --fail-on critical --output table
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
@@ -66,11 +90,6 @@ jobs:
|
||||
COMMIT=${{ github.sha }}
|
||||
BUILD_DATE=${{ github.event.head_commit.timestamp }}
|
||||
|
||||
- name: Scan image for CVEs
|
||||
run: |
|
||||
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin v0.114.0
|
||||
grype lerkolabs/uptop:${{ steps.meta.outputs.tag }} --fail-on critical --output table
|
||||
|
||||
- name: Update Docker Hub description
|
||||
uses: peter-evans/dockerhub-description@v4
|
||||
with:
|
||||
@@ -81,5 +100,7 @@ jobs:
|
||||
- name: Cleanup Docker artifacts
|
||||
if: always()
|
||||
run: |
|
||||
# the scan image is tagged, so image prune won't catch it
|
||||
docker image rm "uptop-scan:${{ steps.meta.outputs.tag }}" 2>/dev/null || true
|
||||
docker image prune -f
|
||||
docker builder prune -f --keep-storage=2GB
|
||||
|
||||
@@ -19,26 +19,35 @@ jobs:
|
||||
run: |
|
||||
API="https://gitea.lerkolabs.com/api/v1/repos/lerkolabs/uptop/releases/tags/${TAG}"
|
||||
|
||||
for i in $(seq 1 20); do
|
||||
# 40 x 30s = 20 min: the Gitea release can queue behind the ~18-min
|
||||
# Docker job on the single runner. Asset count must hold steady for
|
||||
# two consecutive polls — GoReleaser uploads one file at a time, and
|
||||
# mirroring mid-upload would publish a partial asset set.
|
||||
PREV_COUNT=0
|
||||
ASSET_COUNT=0
|
||||
for i in $(seq 1 40); do
|
||||
if RESPONSE=$(curl -sf "$API" 2>/dev/null); then
|
||||
ASSET_COUNT=$(echo "$RESPONSE" | jq '.assets | length')
|
||||
if [ "$ASSET_COUNT" -gt 0 ]; then
|
||||
echo "Found release with $ASSET_COUNT assets"
|
||||
if [ "$ASSET_COUNT" -gt 0 ] && [ "$ASSET_COUNT" -eq "$PREV_COUNT" ]; then
|
||||
echo "Found release with $ASSET_COUNT assets (stable)"
|
||||
break
|
||||
fi
|
||||
echo "Release exists but no assets yet... attempt $i/20"
|
||||
echo "Release has $ASSET_COUNT assets (was $PREV_COUNT)... attempt $i/40"
|
||||
PREV_COUNT="$ASSET_COUNT"
|
||||
else
|
||||
echo "Waiting for Gitea release... attempt $i/20"
|
||||
echo "Waiting for Gitea release... attempt $i/40"
|
||||
fi
|
||||
sleep 30
|
||||
done
|
||||
|
||||
if [ -z "$RESPONSE" ] || [ "$ASSET_COUNT" -eq 0 ]; then
|
||||
echo "::error::Gitea release for ${TAG} not found or has no assets after 10 minutes"
|
||||
echo "::error::Gitea release for ${TAG} not found or has no assets after 20 minutes"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$RESPONSE" | jq -r '.body // empty' > /tmp/release-notes.md
|
||||
# select() so an empty-string body produces an empty file — `// empty`
|
||||
# treats "" as truthy and wrote a blank line, defeating this fallback.
|
||||
echo "$RESPONSE" | jq -r '.body | select(. != null and . != "")' > /tmp/release-notes.md
|
||||
|
||||
if [ ! -s /tmp/release-notes.md ]; then
|
||||
echo "Release ${TAG} from [Gitea](https://gitea.lerkolabs.com/lerkolabs/uptop/releases/tag/${TAG})" > /tmp/release-notes.md
|
||||
@@ -62,8 +71,11 @@ jobs:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAG: ${{ github.ref_name }}
|
||||
run: |
|
||||
PRERELEASE=""
|
||||
case "$TAG" in *-*) PRERELEASE="--prerelease" ;; esac
|
||||
gh release create "$TAG" \
|
||||
--repo "$GITHUB_REPOSITORY" \
|
||||
--title "$TAG" \
|
||||
--notes-file /tmp/release-notes.md \
|
||||
$PRERELEASE \
|
||||
/tmp/assets/*
|
||||
|
||||
+5
-2
@@ -8,6 +8,7 @@ release:
|
||||
gitea:
|
||||
owner: lerkolabs
|
||||
name: uptop
|
||||
prerelease: auto
|
||||
|
||||
builds:
|
||||
- main: ./cmd/uptop
|
||||
@@ -58,5 +59,7 @@ nfpms:
|
||||
dst: /usr/share/doc/uptop/LICENSE
|
||||
type: doc
|
||||
|
||||
changelog:
|
||||
disable: true
|
||||
# Changelog generation must stay enabled: the --release-notes flag is consumed
|
||||
# by the changelog pipe, so disabling it silently drops the git-cliff notes
|
||||
# (empty release body on v0.1.0-rc.1). With --release-notes set, GoReleaser
|
||||
# skips its own generation and uses the file.
|
||||
|
||||
+8
-3
@@ -1,6 +1,11 @@
|
||||
ignore:
|
||||
# CVE-2026-41589: SCP path traversal in charmbracelet/wish.
|
||||
# SCP path traversal in charmbracelet/wish — same flaw, two ids: grype has
|
||||
# matched it as CVE-2026-41589 and as GHSA-xjvp-7243-rg9h depending on db
|
||||
# version, and ignore matching is exact-id, so both stay listed.
|
||||
# We only import wish/bubbletea for the SSH TUI server — the vulnerable
|
||||
# scp.Middleware / scp.NewFileSystemHandler symbols are never compiled in.
|
||||
# No fix available for wish v1; v2 (charm.land/wish/v2) patched in 2.0.1.
|
||||
# scp.Middleware / scp.NewFileSystemHandler symbols are never compiled in
|
||||
# (govulncheck reachability agrees). No fix for wish v1; v2
|
||||
# (charm.land/wish/v2 >= 2.0.1) requires the bubbletea-v2 stack migration,
|
||||
# tracked in issue #126. Remove both entries when that lands.
|
||||
- vulnerability: CVE-2026-41589
|
||||
- vulnerability: GHSA-xjvp-7243-rg9h
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# --- Stage 1: Builder ---
|
||||
FROM golang:1.26-alpine3.23@sha256:91eda9776261207ea25fd06b5b7fed8d397dd2c0a283e77f2ab6e91bfa71079d AS builder
|
||||
FROM golang:1.26.4-alpine3.23@sha256:f23e8b227fb4493eabe03bede4d5a32d04092da71962f1fb79b5f7d1e6c2a17f AS builder
|
||||
WORKDIR /app
|
||||
COPY go.mod go.sum ./
|
||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||
|
||||
@@ -24,6 +24,10 @@ split_commits = false
|
||||
protect_breaking_commits = false
|
||||
filter_commits = false
|
||||
tag_pattern = "v[0-9].*"
|
||||
# rc tags are pipeline rehearsals, not releases — without this, the final
|
||||
# tag's notes would only cover commits since the last rc (near-empty for
|
||||
# v0.1.0). Ignored tags fold their commits into the next real release.
|
||||
ignore_tags = "v.*-rc.*"
|
||||
topo_order = false
|
||||
sort_commits = "oldest"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user