Watch
1
0
Fork
You've already forked souveraine
0

project the tested ref onto the public forge

This commit is contained in:
Fimeg 2026-08-23 21:21:23 -04:00
commit db593a2036

View file

@ -131,3 +131,33 @@ jobs:
exit 1
fi
echo "All action refs are SHA-pinned."
# The projection. Gitea is the only thing that publishes.
sync-public:
runs-on: ubuntu-latest
needs: [rust-test, no-ai-attribution, action-pins]
if: github.ref == 'refs/heads/public'
env:
PUBLIC_FORGE_TOKEN: ${{ secrets.PUBLIC_FORGE_TOKEN }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Publish and verify exact SHA
run: |
set -euo pipefail
: "${PUBLIC_FORGE_TOKEN:?PUBLIC_FORGE_TOKEN is required}"
expected="${GITHUB_SHA}"
forge_url='https://forge.caseytunturi.com/Fimeg/souveraine.git'
remote_sha="$(git ls-remote "$forge_url" refs/heads/public | awk '{print $1}')"
if [ -n "$remote_sha" ]; then
git cat-file -e "${remote_sha}^{commit}" 2>/dev/null || {
echo "[publish] remote public SHA is not in tested history" >&2; exit 1; }
git merge-base --is-ancestor "$remote_sha" "$expected" || {
echo "[publish] refusing non-fast-forward public history" >&2; exit 1; }
fi
auth="$(printf 'publisher-souveraine:%s' "$PUBLIC_FORGE_TOKEN" | base64 -w0)"
git -c "http.https://forge.caseytunturi.com/.extraheader=Authorization: Basic $auth" \
push "$forge_url" public:public
test "$(git ls-remote "$forge_url" refs/heads/public | awk '{print $1}')" = "$expected"
echo "[publish] exact SHA is anonymous on Forgejo: $expected"