This commit is contained in:
Mark Randall Havens 2025-06-09 18:15:22 -05:00
parent c1c87bba09
commit 19b5f1d620
11 changed files with 1376 additions and 156 deletions

View file

@ -33,10 +33,17 @@ DOCS_NOJEKYLL="$DOCS_DIR/.nojekyll"
DOCS_ROBOTS="$DOCS_DIR/robots.txt"
DOCS_SITEMAP="$DOCS_DIR/sitemap.xml"
DOCS_INTEGRITY="$DOCS_DIR/integrity.sha256"
GITLAB_CI="$REPO_PATH/.gitlab-ci.yml"
CODEBERG_CI="$REPO_PATH/.codeberg-ci.yml"
TIMESTAMP=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
SCRIPT_VERSION="1.4" # Updated for GPG integration
SCRIPT_VERSION="1.5" # Updated for CI/CD and GPG enhancements
PRESERVE_META=${PRESERVE_META:-false} # Preserve existing metadata
FORCE_DOCS=${FORCE_DOCS:-false} # Force overwrite of /docs metadata
SKIP_CI=${SKIP_CI:-false} # Skip CI/CD file generation
GPG_FORCE=${GPG_FORCE:-true} # Force GPG overwrites
CI_STATUS=${CI_STATUS:-mock} # Mock or live CI status
CI_STATUS_GITLAB="unknown"
CI_STATUS_CODEBERG="unknown"
# URLs for each platform
CANONICAL_URL="https://remember.thefoldwithin.earth/mrhavens/$REPO_NAME"
@ -128,7 +135,7 @@ sign_file() {
return
fi
for key_id in "${GPG_KEYS[@]}"; do
gpg --armor --detach-sign --default-key "$key_id" "$file" > "$sig_file.$key_id" 2>/dev/null || warn "Failed to sign $file with key $key_id, continuing..."
gpg --armor --detach-sign --default-key "$key_id" --yes --batch "$file" > "$sig_file.$key_id" 2>/dev/null || warn "Failed to sign $file with key $key_id, continuing..."
if [ -f "$sig_file.$key_id" ]; then
git -C "$REPO_PATH" add "$sig_file.$key_id"
git -C "$REPO_PATH" commit -m "Signed $file with GPG key $key_id at $TIMESTAMP" || warn "No changes to commit for $sig_file.$key_id"
@ -158,6 +165,81 @@ copy_to_docs() {
info "Copied $src to $dest and committed"
}
# ╭─────────────────────────────────────╮
# │ CI/CD GENERATION │
# ╰─────────────────────────────────────╮
generate_gitlab_ci() {
if [ "$SKIP_CI" = "true" ]; then
info "Skipping .gitlab-ci.yml generation (--skip-ci enabled)"
return
fi
info "Generating $GITLAB_CI..."
if [ "$PRESERVE_META" = "true" ] && [ -f "$GITLAB_CI" ]; then
info "Preserving existing $GITLAB_CI (--preserve-meta enabled)"
return
fi
cat > "$GITLAB_CI" <<EOF
# GitLab CI configuration for GitField Pages deployment
# Generated by gitfield-sync at $TIMESTAMP (v$SCRIPT_VERSION)
stages:
- deploy
pages:
stage: deploy
script:
- cp -r docs/ public/
artifacts:
paths:
- public
only:
- main
EOF
git -C "$REPO_PATH" add "$GITLAB_CI"
git -C "$REPO_PATH" commit -m "Generated .gitlab-ci.yml at $TIMESTAMP" || warn "No changes to commit for $GITLAB_CI"
info "Generated and committed $GITLAB_CI"
}
generate_codeberg_ci() {
if [ "$SKIP_CI" = "true" ]; then
info "Skipping .codeberg-ci.yml generation (--skip-ci enabled)"
return
fi
if ! git -C "$REPO_PATH" remote -v | grep -q "codeberg.org"; then
info "No Codeberg remote detected, skipping .codeberg-ci.yml generation"
return
fi
info "Generating $CODEBERG_CI..."
if [ "$PRESERVE_META" = "true" ] && [ -f "$CODEBERG_CI" ]; then
info "Preserving existing $CODEBERG_CI (--preserve-meta enabled)"
return
fi
cat > "$CODEBERG_CI" <<EOF
# Codeberg CI configuration for GitField Pages deployment
# Generated by gitfield-sync at $TIMESTAMP (v$SCRIPT_VERSION)
name: Deploy Pages
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Copy docs to public
run: cp -r docs/ public/
- name: Deploy to Codeberg Pages
uses: actions/upload-pages-artifact@v1
with:
path: public
EOF
git -C "$REPO_PATH" add "$CODEBERG_CI"
git -C "$REPO_PATH" commit -m "Generated .codeberg-ci.yml at $TIMESTAMP" || warn "No changes to commit for $CODEBERG_CI"
info "Generated and committed $CODEBERG_CI"
}
# ╭─────────────────────────────────────╮
# │ METADATA GENERATION │
# ╰─────────────────────────────────────╮
@ -185,7 +267,11 @@ $(printf ' "%s",\n' "${MIRRORS[@]}" | sed '$ s/,$//')
$(for i in "${!GPG_KEYS[@]}"; do
echo " {\"key_id\": \"${GPG_KEYS[i]}\", \"name\": \"${GPG_NAMES[i]}\", \"email\": \"${GPG_EMAILS[i]}\"}" | sed '$ s/,$//'
done)
]
],
"ci_status": {
"gitlab": "$CI_STATUS_GITLAB",
"codeberg": "$CI_STATUS_CODEBERG"
}
}
EOF
# Sanitize rad:rad:
@ -226,6 +312,11 @@ $(for i in "${!GPG_KEYS[@]}"; do
echo "- **${GPG_NAMES[i]}** <${GPG_EMAILS[i]}> (Key ID: ${GPG_KEYS[i]})"
done)
## CI/CD Status
- **GitLab Pages**: $CI_STATUS_GITLAB
- **Codeberg Pages**: $CI_STATUS_CODEBERG
## Mirror Repositories
The project is mirrored across multiple platforms to enhance redundancy and accessibility:
@ -285,7 +376,11 @@ $(printf ' "%s",\n' "${MIRRORS[@]}" | sed '$ s/,$//')
$(for i in "${!GPG_KEYS[@]}"; do
echo " {\"key_id\": \"${GPG_KEYS[i]}\", \"name\": \"${GPG_NAMES[i]}\", \"email\": \"${GPG_EMAILS[i]}\"}" | sed '$ s/,$//'
done)
]
],
"ci_status": {
"gitlab": "$CI_STATUS_GITLAB",
"codeberg": "$CI_STATUS_CODEBERG"
}
}
EOF
# Sanitize rad:rad:
@ -324,7 +419,11 @@ $(printf ' "%s",\n' "${MIRRORS[@]}" | sed '$ s/,$//')
$(for i in "${!GPG_KEYS[@]}"; do
echo " {\"key_id\": \"${GPG_KEYS[i]}\", \"name\": \"${GPG_NAMES[i]}\", \"email\": \"${GPG_EMAILS[i]}\"}" | sed '$ s/,$//'
done)
]
],
"ci_status": {
"gitlab": "$CI_STATUS_GITLAB",
"codeberg": "$CI_STATUS_CODEBERG"
}
}
EOF
# Sanitize rad:rad:
@ -417,7 +516,11 @@ $(printf ' "%s",\n' "${MIRRORS[@]}" | sed '$ s/,$//')
$(for i in "${!GPG_KEYS[@]}"; do
echo " {\"key_id\": \"${GPG_KEYS[i]}\", \"name\": \"${GPG_NAMES[i]}\", \"email\": \"${GPG_EMAILS[i]}\"}" | sed '$ s/,$//'
done)
]
],
"ci_status": {
"gitlab": "$CI_STATUS_GITLAB",
"codeberg": "$CI_STATUS_CODEBERG"
}
}
</script>
</head>
@ -435,9 +538,14 @@ done)
<p>Signed with the following GPG keys:</p>
<ul>
$(for i in "${!GPG_KEYS[@]}"; do
echo " <li>${GPG_NAMES[i]} &lt;${GPG_EMAILS[i]}&gt; (Key ID: ${GPG_KEYS[i]})</li>"
echo " <li>${GPG_NAMES[i]} <${GPG_EMAILS[i]}> (Key ID: ${GPG_KEYS[i]})</li>"
done)
</ul>
<p>CI/CD Status:</p>
<ul>
<li>GitLab Pages: $CI_STATUS_GITLAB</li>
<li>Codeberg Pages: $CI_STATUS_CODEBERG</li>
</ul>
</section>
<section>
<h2>Mirror Repositories</h2>
@ -466,15 +574,15 @@ done)
</section>
<section>
<h2>Why Recursive Sovereignty Matters</h2>
<p>The GitField framework distributes <code>$REPO_NAME</code> across decentralized (Radicle), self-hosted (Forgejo), and community-driven (Codeberg, Gitea) platforms, alongside mainstream services (GitHub, GitLab, Bitbucket). This recursive strategy defends against past deplatforming attempts by individuals such as Joel Johnson, Dr. Peter Gaied, and Andrew LeCody, ensuring the project's persistence and accessibility.</p>
<p>The GitField framework distributes <code>$REPO_NAME</code> across decentralized (Radicle), self-hosted (Forgejo), and community-driven (Codeberg, Gitea) platforms, alongside mainstream services (GitHub, GitLab, Bitbucket). This recursive strategy defends against past deplatforming attempts by individuals such as Joel Johnson, Dr. LeCody, and Andrew LeCody, ensuring the project's persistence and accessibility.</p>
</section>
<section>
<h2>Source Links</h2>
<p>Access the project's metadata and logs:</p>
<ul>
<li><a href="pushed.log">pushed.log</a> (Audit trail of sync operations)</li>
<li><a href="../GITFIELD.md">GITFIELD.md</a> (Multi-repository strategy overview)</li>
<li><a href="gitfield.README.txt">gitfield.README.txt</a> (Metadata directory explanation)</li>
<li><a href="pushed.log">pushed Log</a> (Audit trail of sync operations)</li>
<li><a href="../GITFIELD_GITLAB.md">GitLab</a> (Multi-repo manifest)</a></li>
<li><a href="gitfieldtown.README.txt">GitField</a> README.txt</a> (Metadata directory explanation)</li>
</ul>
</section>
</main>
@ -494,7 +602,7 @@ EOF
generate_docs_css() {
info "Generating $DOCS_CSS..."
mkdir -p "$DOCS_DIR"
if [ "$PRESERVE_META" = "true" ] && [ -f "$DOCS_CSS" ]; then
if [ -f "$DOCS_CSS" ] && [ "$PRESERVE_META" = "true" ]; then
info "Preserving existing $DOCS_CSS (--preserve-meta enabled)"
return
fi
@ -573,15 +681,19 @@ $(printf ' "%s",\n' "${MIRRORS[@]}" | sed '$ s/,$//')
$(for i in "${!GPG_KEYS[@]}"; do
echo " {\"key_id\": \"${GPG_KEYS[i]}\", \"name\": \"${GPG_NAMES[i]}\", \"email\": \"${GPG_EMAILS[i]}\"}" | sed '$ s/,$//'
done)
]
],
"ci_status": {
"gitlab": "$CI_STATUS_GITLAB",
"codeberg": "$CI_STATUS_CODEBERG"
}
}
EOF
# Sanitize rad:rad:
sed -i 's/rad:rad:/rad:/g' "$DOCS_REPOS_JSON"
git -C "$REPO_PATH" add "$DOCS_REPOS_JSON"
git -C "$REPO_PATH" commit -m "Generated docs/repos.json at $TIMESTAMP" || warn "No changes to commit for $DOCS_REPOS_JSON"
info "Generated and committed $DOCS_REPOS_JSON"
sign_file "$DOCS_REPOS_JSON"
info "Generated and committed $DOCS_REPOS_JSON"
}
generate_docs_readme() {
@ -594,7 +706,7 @@ generate_docs_readme() {
cat > "$DOCS_README" <<EOF
# GitField /docs Directory
The `/docs` directory hosts a public-facing, SEO-optimized canonical declaration for the \`$REPO_NAME\` repository, designed for GitHub Pages compatibility and enhanced discoverability.
The `/docs` directory hosts a public-facing, SEO-optimized canonical declaration for the \`$REPO_NAME\` repository, designed for GitHub Pages, GitLab Pages, and Codeberg Pages compatibility and enhanced discoverability.
## Files
@ -614,6 +726,11 @@ The `/docs` directory hosts a public-facing, SEO-optimized canonical declaration
- **sitemap.xml**: Auto-generated sitemap for improved SEO.
- **integrity.sha256**: SHA-256 hash of all metadata files for integrity verification.
## CI/CD Integration
- **GitLab Pages**: Deployed via `.gitlab-ci.yml`, status: $CI_STATUS_GITLAB
- **Codeberg Pages**: Deployed via `.codeberg-ci.yml`, status: $CI_STATUS_CODEBERG
## Purpose
This directory ensures the \`$REPO_NAME\` project is discoverable via search engines and accessible to humans and bots. It declares the canonical repository at [$CANONICAL_URL]($CANONICAL_URL) and links to all mirrors, reinforcing the GitField recursive metadata strategy for sovereign publishing.
@ -679,6 +796,18 @@ generate_docs_sitemap() {
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>$GITLAB_URL/-/jobs/artifacts/main/raw/public/index.html?job=pages</loc>
<lastmod>$TIMESTAMP</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://mrhavens.codeberg.page/$REPO_NAME/index.html</loc>
<lastmod>$TIMESTAMP</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>$GITHUB_URL/docs/canonical.meta</loc>
<lastmod>$TIMESTAMP</lastmod>
@ -704,7 +833,8 @@ generate_docs_sitemap() {
<priority>0.8</priority>
</url>
<url>
<loc>$GITHUB_URL/docs/.well-known/gitfield.json</loc>
<loc>$GITHUB_URL/docs/.well-known/repo.$REPO_NAME.json</loc>
<url>
<lastmod>$TIMESTAMP</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
@ -722,7 +852,7 @@ generate_docs_sitemap() {
<priority>0.8</priority>
</url>
<url>
<loc>$GITHUB_URL/docs/gitfield.README.txt</loc>
<url>$GITHUB_URL/docs/gitfieldtown.README.txt</loc>
<lastmod>$TIMESTAMP</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
@ -730,7 +860,7 @@ generate_docs_sitemap() {
$(for mirror in "${MIRRORS[@]}"; do
if [[ "$mirror" != rad:* ]]; then
echo " <url>"
echo " <loc>$mirror</loc>"
echo " <loc>$mirror</loc></loc>"
echo " <lastmod>$TIMESTAMP</lastmod>"
echo " <changefreq>weekly</changefreq>"
echo " <priority>0.8</priority>"
@ -756,7 +886,7 @@ generate_docs_integrity() {
# Generated by gitfield-sync at $TIMESTAMP (v$SCRIPT_VERSION)
EOF
for file in "$DOCS_CANONICAL_META" "$DOCS_CANONICAL_MD" "$DOCS_INDEX_JSON" "$DOCS_GITFIELD_JSON" "$DOCS_WELL_KNOWN_JSON" "$DOCS_REPOS_JSON" "$DOCS_PUSHED_LOG" "$DOCS_GITFIELD_README"; do
for file in "$DOCS_CANNONICAL_META" "$DOCS_CANNICAL_MD" "$DOCS_INDEX_JSON" "$DOCS_GITFIELD_JSON" "$DOCS_WELL_KNOWN_JSON" "$DOCS_REPOS_JSON" "$DOCS_PUSHED_LOG" "$DOCS_GITFIELD_README"; do
if [ -f "$file" ]; then
sha256sum "$file" >> "$DOCS_INTEGRITY" || warn "Failed to compute SHA-256 for $file, continuing..."
else
@ -765,21 +895,54 @@ EOF
done
git -C "$REPO_PATH" add "$DOCS_INTEGRITY"
git -C "$REPO_PATH" commit -m "Generated docs/integrity.sha256 at $TIMESTAMP" || warn "No changes to commit for $DOCS_INTEGRITY"
info "Generated and committed $DOCS_INTEGRITY"
sign_file "$DOCS_INTEGRITY"
info "Generated and committed $DOCS_INTEGRITY"
}
# ╭─────────────────────────────────────╮
# │ INITIAL SETUP
# │ TRIGGER CI PIPELINE
# ╰─────────────────────────────────────╮
mkdir -p "$GITFIELD_DIR" "$WELL_KNOWN_DIR" "$DOCS_DIR" "$DOCS_WELL_KNOWN_DIR"
trigger_ci_pipeline() {
local platform=$1
local url=$2
local token_var=$3
local project_id=$4
local timestamp=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
if [ ! -f "$LOG_FILE" ]; then
echo "# Push Log for $REPO_NAME" > "$LOG_FILE"
echo "# Generated by gitfield-sync" >> "$LOG_FILE"
echo "" >> "$LOG_FILE"
if [ "$CI_STATUS" = "mock" ]; then
info "CI status set to mock, skipping $platform pipeline trigger"
echo "[$timestamp] $platform: Pipeline trigger skipped (mock mode)" >> "$LOG_FILE"
copy_to_docs "$LOG_FILE" "$DOCS_PUSHED_LOG"
return
fi
if [ -z "${!token_var}" ]; then
warn "$platform API token ($token_var) not set, skipping pipeline trigger"
echo "[$timestamp] $platform: Pipeline trigger skipped (no API token)" >> "$LOG_FILE"
copy_to_docs "$LOG_FILE" "$DOCS_PUSHED_LOG"
return
fi
local response
if [ "$platform" = "GitLab" ]; then
response=$(curl -s -X POST \
-H "PRIVATE-TOKEN: ${!token_var}" \
"$url/api/v4/projects/$project_id/pipeline?ref=main" | jq '.status' 2>/dev/null)
elif [ "$platform" = "Codeberg" ]; then
response=$(curl -s -X POST \
-H "Authorization: Bearer ${!token_var}" \
"$url/api/v1/repos/mrhavens/$REPO_NAME/actions/runs" | jq '.status' 2>/dev/null)
fi
if [ -n "$response" ]; then
echo "[$timestamp] $platform: Pipeline triggered, status: $response" >> "$LOG_FILE"
info "$platform pipeline triggered, status: $response"
else
echo "[$timestamp] $platform: Pipeline trigger failed" >> "$LOG_FILE"
warn "$platform pipeline trigger failed"
fi
copy_to_docs "$LOG_FILE" "$DOCS_PUSHED_LOG"
fi
}
# ╭─────────────────────────────────────╮
# │ GENERATE GITFIELD.MD │
@ -828,6 +991,7 @@ The following platforms host the \`$REPO_NAME\` repository, each chosen for its
### 3. Codeberg
- **URL**: [$CODEBERG_URL]($CODEBERG_URL)
- **CI/CD Status**: $CI_STATUS_CODEBERG
- **Purpose**: Codeberg is a community-driven, open-source platform powered by Forgejo, offering a reliable and ethical alternative for hosting git repositories.
- **Value**: Enhances project resilience with its open-source ethos and independent infrastructure, ensuring accessibility and community support.
@ -838,6 +1002,7 @@ The following platforms host the \`$REPO_NAME\` repository, each chosen for its
### 5. GitLab
- **URL**: [$GITLAB_URL]($GITLAB_URL)
- **CI/CD Status**: $CI_STATUS_GITLAB
- **Purpose**: GitLab offers a comprehensive DevOps platform with advanced CI/CD capabilities, private repository options, and robust access controls. It serves as a reliable backup and a platform for advanced automation workflows.
- **Value**: Enhances project resilience with its integrated CI/CD pipelines and independent infrastructure, reducing reliance on a single provider.
@ -862,7 +1027,7 @@ The decision to maintain multiple repositories stems from the need to safeguard
- **Diversity**: Each platforms unique features (e.g., GitHubs community, GitLabs CI/CD, Bitbuckets integrations, Radicles decentralization, Forgejos self-hosting, Codebergs community-driven model, Giteas lightweight efficiency) enhance the projects functionality and reach.
- **Transparency**: Metadata snapshots in the \`.gitfield\` directory (for internal audit) and public-facing documentation in the \`/docs\` directory provide a verifiable record of the projects state across all platforms.
This multi-repository approach, bolstered by Forgejos sovereign hosting and GitHub Pages discoverability, reflects a commitment to preserving the integrity, accessibility, and independence of \`$REPO_NAME\`, ensuring it remains available to contributors and users regardless of external pressures.
This multi-repository approach, bolstered by Forgejos sovereign hosting, GitHub Pages, GitLab Pages, and Codeberg Pages discoverability, reflects a commitment to preserving the integrity, accessibility, and independence of \`$REPO_NAME\`, ensuring it remains available to contributors and users regardless of external pressures.
---
@ -873,11 +1038,17 @@ This multi-repository approach, bolstered by Forgejos sovereign hosting and G
- **SEO Metadata**: SEO-friendly metadata with Schema.org JSON-LD is available in [\`docs/gitfield.json\`](./docs/gitfield.json) and [\`docs/.well-known/gitfield.json\`](./docs/.well-known/gitfield.json).
- **Push Log**: The [\`docs/pushed.log\`](./docs/pushed.log) file records the date, time, commit hash, and RID/URL of every push operation across all platforms, providing a transparent audit trail.
- **GitField Directory**: The \`.gitfield\` directory contains internal metadata and platform-specific sigils (e.g., \`github.sigil.md\`). See [\`docs/gitfield.README.txt\`](./docs/gitfield.README.txt) for details.
- **GitHub Pages**: A public-facing, SEO-optimized canonical declaration is available in [\`docs/index.html\`](./docs/index.html), with a sitemap in [\`docs/sitemap.xml\`](./docs/sitemap.xml) and integrity hashes in [\`docs/integrity.sha256\`](./docs/integrity.sha256).
- **Pages Deployments**: Public-facing declarations are available at:
- GitHub Pages: [$GITHUB_URL/docs/index.html]($GITHUB_URL/docs/index.html)
- GitLab Pages: [$GITLAB_URL/-/jobs/artifacts/main/raw/public/index.html?job=pages]($GITLAB_URL/-/jobs/artifacts/main/raw/public/index.html?job=pages)
- Codeberg Pages: [https://mrhavens.codeberg.page/$REPO_NAME/index.html](https://mrhavens.codeberg.page/$REPO_NAME/index.html)
- **GPG Signatures**: Metadata files are signed with the following GPG keys:
$(for i in "${!GPG_KEYS[@]}"; do
echo " - ${GPG_NAMES[i]} <${GPG_EMAILS[i]}> (Key ID: ${GPG_KEYS[i]})"
done)
- **CI/CD Status**:
- GitLab: $CI_STATUS_GITLAB
- Codeberg: $CI_STATUS_CODEBERG
- **Recursive Sync**: The repository is synchronized across all platforms in a recursive loop (three cycles) to ensure interconnected metadata captures the latest state of the project.
- **Push Order**: The repository is synchronized in the following order: **Radicle → Forgejo → Codeberg → Gitea → GitLab → Bitbucket → GitHub**. This prioritizes Radicles decentralized, censorship-resistant network as the primary anchor, followed by Forgejos sovereign, self-hosted infrastructure, Codebergs community-driven platform, Giteas lightweight efficiency, GitLabs robust DevOps features, Bitbuckets enterprise redundancy, and GitHubs broad visibility, ensuring a resilient and accessible metadata chain.
@ -932,6 +1103,8 @@ execute_push() {
local url=$3
local rid=$4
local peer_id=$5
local token_var=$6
local project_id=$7
local script_path
script_path=$(find_script "$script_name") || error "Failed to find $script_name"
info "Executing $platform push with script: $script_path"
@ -941,6 +1114,9 @@ execute_push() {
log_url "$platform" "$url" "$rid" "$peer_id"
git add . || warn "Nothing to add after $script_path"
git commit -m "Post-$platform sync at $TIMESTAMP" || warn "No changes to commit after $script_path"
if [ "$platform" = "GitLab" ] || [ "$platform" = "Codeberg" ]; then
trigger_ci_pipeline "$platform" "$url" "$token_var" "$project_id"
fi
popd >/dev/null
else
error "Script $script_path is not executable"
@ -955,14 +1131,14 @@ run_push_cycle() {
info "Starting push cycle $cycle_number..."
SYNC_CYCLES=$cycle_number
execute_push "gitfield-local" "Local" "" "" ""
execute_push "gitfield-radicle" "Radicle" "" "$RADICLE_RID" "$RADICLE_PEER_ID"
execute_push "gitfield-remember" "Forgejo" "$FORGEJO_URL" "" ""
execute_push "gitfield-codeberg" "Codeberg" "$CODEBERG_URL" "" ""
execute_push "gitfield-gitea" "Gitea" "$GITEA_URL" "" ""
execute_push "gitfield-gitlab" "GitLab" "$GITLAB_URL" "" ""
execute_push "gitfield-bitbucket" "Bitbucket" "$BITBUCKET_URL" "" ""
execute_push "gitfield-github" "GitHub" "$GITHUB_URL" "" ""
execute_push "gitfield-local" "Local" "" "" "" "" ""
execute_push "gitfield-radicle" "Radicle" "" "$RADICLE_RID" "$RADICLE_PEER_ID" "" ""
execute_push "gitfield-remember" "Forgejo" "$FORGEJO_URL" "" "" "" ""
execute_push "gitfield-codeberg" "Codeberg" "$CODEBERG_URL" "" "" "CODEBERG_TOKEN" "mrhavens/$REPO_NAME"
execute_push "gitfield-gitea" "Gitea" "$GITEA_URL" "" "" "" ""
execute_push "gitfield-gitlab" "GitLab" "$GITLAB_URL" "" "" "GITLAB_TOKEN" "mrhavens/$REPO_NAME"
execute_push "gitfield-bitbucket" "Bitbucket" "$BITBUCKET_URL" "" "" "" ""
execute_push "gitfield-github" "GitHub" "$GITHUB_URL" "" "" "" ""
# Regenerate metadata after each cycle to update sync_cycles
generate_canonical_meta
@ -978,11 +1154,13 @@ run_push_cycle() {
generate_docs_robots
generate_docs_sitemap
generate_docs_integrity
generate_gitlab_ci
generate_codeberg_ci
}
# ╭─────────────────────────────────────╮
# │ MAIN EXECUTION │
# ╰─────────────────────────────────────
# ╰─────────────────────────────────────
info "Starting gitfield-sync for $REPO_NAME..."
# Parse flags
@ -998,6 +1176,24 @@ while [ $# -gt 0 ]; do
info "Force docs overwrite flag enabled"
shift
;;
--skip-ci)
SKIP_CI=true
info "Skip CI generation flag enabled"
shift
;;
--gpg-force)
GPG_FORCE=true
info "GPG force overwrite flag enabled"
shift
;;
--ci-status=*)
CI_STATUS="${1#*=}"
if [[ ! "$CI_STATUS" =~ ^(mock|live)$ ]]; then
error "Invalid --ci-status value: $CI_STATUS, must be 'mock' or 'live'"
fi
info "CI status set to $CI_STATUS"
shift
;;
*)
warn "Unknown argument: $1"
shift
@ -1008,8 +1204,8 @@ done
if [ ! -d "$REPO_PATH/.git" ]; then
pushd "$REPO_PATH" >/dev/null
git init
git add .
git commit -m "Initial commit" || warn "Nothing to commit"
git add . || warn "Nothing to commit"
git commit -m "Initial commit" || warn "No changes to commit"
popd >/dev/null
fi
@ -1027,6 +1223,8 @@ generate_docs_nojekyll
generate_docs_robots
generate_docs_sitemap
generate_docs_integrity
generate_gitlab_ci
generate_codeberg_ci
# Run push cycles
run_push_cycle 1