Watch
1
0
Fork
You've already forked SouveraineOS
0

ci: hold the public edge through DNS

This commit is contained in:
Fimeg 2026-08-25 08:07:07 -04:00
commit 4f5eb9b34d

View file

@ -5,6 +5,7 @@ on:
branches: [main, public] branches: [main, public]
pull_request: pull_request:
branches: [main, public] branches: [main, public]
workflow_dispatch:
jobs: jobs:
validate: validate:
@ -31,7 +32,14 @@ jobs:
: "${PUBLIC_FORGE_TOKEN:?PUBLIC_FORGE_TOKEN is required}" : "${PUBLIC_FORGE_TOKEN:?PUBLIC_FORGE_TOKEN is required}"
expected="${GITHUB_SHA}" expected="${GITHUB_SHA}"
forge_url='https://forge.caseytunturi.com/Fimeg/SouveraineOS.git' forge_url='https://forge.caseytunturi.com/Fimeg/SouveraineOS.git'
remote_sha="$(git ls-remote "$forge_url" refs/heads/public | awk '{print $1}')" remote_sha=''
for attempt in 1 2 3; do
if remote_sha="$(git ls-remote "$forge_url" refs/heads/public | awk '{print $1}')"; then
break
fi
test "$attempt" -lt 3 || exit 1
sleep $((attempt * 10))
done
if [ -n "$remote_sha" ]; then if [ -n "$remote_sha" ]; then
git cat-file -e "${remote_sha}^{commit}" 2>/dev/null || { git cat-file -e "${remote_sha}^{commit}" 2>/dev/null || {
echo "[publish] remote public SHA is not in tested history" >&2; exit 1; } echo "[publish] remote public SHA is not in tested history" >&2; exit 1; }
@ -39,7 +47,22 @@ jobs:
echo "[publish] refusing non-fast-forward public history" >&2; exit 1; } echo "[publish] refusing non-fast-forward public history" >&2; exit 1; }
fi fi
auth="$(printf 'publisher-souveraineos:%s' "$PUBLIC_FORGE_TOKEN" | base64 -w0)" auth="$(printf 'publisher-souveraineos:%s' "$PUBLIC_FORGE_TOKEN" | base64 -w0)"
git -c "http.https://forge.caseytunturi.com/.extraheader=Authorization: Basic $auth" \ for attempt in 1 2 3; do
push "$forge_url" public:public if git -c "http.https://forge.caseytunturi.com/.extraheader=Authorization: Basic $auth" \
test "$(git ls-remote "$forge_url" refs/heads/public | awk '{print $1}')" = "$expected" push "$forge_url" public:public; then
break
fi
test "$attempt" -lt 3 || exit 1
sleep $((attempt * 10))
done
observed=''
for attempt in 1 2 3; do
if observed="$(git ls-remote "$forge_url" refs/heads/public | awk '{print $1}')"; then
test "$observed" = "$expected"
break
fi
test "$attempt" -lt 3 || exit 1
sleep $((attempt * 10))
done
test "$observed" = "$expected"
echo "[publish] exact SHA is anonymous on Forgejo: $expected" echo "[publish] exact SHA is anonymous on Forgejo: $expected"