Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/mirror-cnb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Mirror to CNB

# Syncs main's plugin index, deltas, recommendations, latest plugin release archives and SVG icons
# to https://cnb.cool/lithe-idea/Lithe-store so mainland users can browse and download plugins
# directly via CNB with automatic GitHub fallback.
on:
push:
branches: [main]
paths:
- lithe-plugin-index.json
- lithe-plugin-deltas.json
- lithe-plugin-recommendations.json
- assets/**
- scripts/mirror-cnb.mjs
workflow_dispatch:
inputs:
plugin:
description: "Only mirror this plugin ID (empty = all)"
required: false
default: ""
keep_versions:
description: "Number of latest versions to keep per plugin"
required: false
default: "3"

permissions:
contents: read

concurrency:
group: mirror-cnb
cancel-in-progress: false

jobs:
mirror:
name: Mirror store and plugin archives to CNB
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
ref: main
fetch-depth: 0

- uses: actions/setup-node@v7
with:
node-version: 22

- name: Sync repository and plugin packages to CNB
env:
CNB_TOKEN: ${{ secrets.CNB_TOKEN }}
PLUGIN: ${{ inputs.plugin }}
KEEP_VERSIONS: ${{ inputs.keep_versions }}
run: |
if [[ -z "${CNB_TOKEN:-}" ]]; then
printf '%s\n' 'CNB_TOKEN is not set; skipping CNB mirror.'
exit 0
fi
args=()
if [[ -n "$PLUGIN" ]]; then
args+=(--plugin "$PLUGIN")
fi
if [[ -n "$KEEP_VERSIONS" ]]; then
args+=(--keep-versions "$KEEP_VERSIONS")
fi
node scripts/mirror-cnb.mjs "${args[@]}"
Loading