From 87e8c8d6e4e2bf5e2a2afdcb8a06f796edc4be0a Mon Sep 17 00:00:00 2001 From: Antigravity Agent Date: Sat, 30 May 2026 04:24:40 +0000 Subject: [PATCH] Add CD workflow to synchronize the Git Mesh --- .forgejo/workflows/cd.yaml | 75 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .forgejo/workflows/cd.yaml diff --git a/.forgejo/workflows/cd.yaml b/.forgejo/workflows/cd.yaml new file mode 100644 index 00000000..39bfb4b4 --- /dev/null +++ b/.forgejo/workflows/cd.yaml @@ -0,0 +1,75 @@ +name: Fortress Self-Archival +on: + push: + branches: + - master + +jobs: + archive: + runs-on: ubuntu-latest + steps: + - name: Check out Fortress + uses: actions/checkout@v4 + + - name: Install Kubectl + run: | + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl + + - name: Pin to IPFS Sanctum + run: | + # Copy to IPFS pod + POD_NAME=$(kubectl get pods -l app=ipfs-node -o jsonpath="{.items[0].metadata.name}") + kubectl exec $POD_NAME -- mkdir -p /tmp/archives/knowledge-fortress + kubectl cp . $POD_NAME:/tmp/archives/knowledge-fortress + + # Generate Hash + CID=$(kubectl exec $POD_NAME -- ipfs add -r -Q /tmp/archives/knowledge-fortress) + echo "=========================================" + echo "Knowledge Engineering Fortress Archived!" + echo "CID: $CID" + echo "=========================================" + + # Clean up + kubectl exec $POD_NAME -- rm -rf /tmp/archives/knowledge-fortress + + - name: Mirror to GitHub + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [ -n "$GITHUB_TOKEN" ]; then + git remote add github https://x-access-token:${GITHUB_TOKEN}@github.com/mrhavens/${{ github.event.repository.name }}.git + git push --force --all github + git push --force --tags github + echo "Successfully mirrored to GitHub!" + else + echo "GITHUB_TOKEN secret not found. Skipping GitHub mirror." + fi + + - name: Sync to Radicle Network + run: | + RAD_POD=$(kubectl get pods -n radicle -l app=radicle -o jsonpath="{.items[0].metadata.name}") + kubectl exec -n radicle $RAD_POD -- mkdir -p /tmp/sync-repo + # We use tar to ensure .git and all hidden files are cleanly preserved + tar czf - . | kubectl exec -n radicle -i $RAD_POD -- tar xzf - -C /tmp/sync-repo + + kubectl exec -n radicle $RAD_POD -- bash -c ' + export RAD_HOME=/radicle/.radicle + export RAD_PASSPHRASE="sovereign" + export PATH=$PATH:/radicle/bin + cd /tmp/sync-repo + chown -R $(id -u):$(id -g) . + + # Check if repository is already initialized in Radicle + if ! rad inspect > /dev/null 2>&1; then + echo "Initializing Radicle repository..." + rad init --name "${{ github.event.repository.name }}" --description "Sovereign Canon" --default-branch master --public --no-confirm + else + echo "Pushing updates to Radicle..." + git push rad master + fi + + # Clean up + cd / + rm -rf /tmp/sync-repo + '