chore: initialize Reims-Go plugin market and add official.lang.zh-tw v1.0.0
This commit is contained in:
commit
7ad21f30cd
10 files changed
+915
No files matched your search
@@ -0,0 +1,99 @@
|
||||
name: PR Plugin Gate
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'registry.json'
|
||||
- 'withdrawn.json'
|
||||
- 'scripts/**'
|
||||
- 'keys/**'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout plugins repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Check if registry has active plugins
|
||||
id: reg
|
||||
run: |
|
||||
count=$(node -e "const r = JSON.parse(require('fs').readFileSync('registry.json','utf8')); console.log((r.plugins||[]).length)")
|
||||
echo "count=$count" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Setup Go for reims-go doctor CLI
|
||||
if: steps.reg.outputs.count != '0'
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Build headless reims-go CLI from Nwflower/Reims-Go
|
||||
if: steps.reg.outputs.count != '0'
|
||||
run: |
|
||||
git clone --depth 1 https://github.com/Nwflower/Reims-Go.git /tmp/reims-go-src
|
||||
cd /tmp/reims-go-src
|
||||
mkdir -p cmd/reims-doctor
|
||||
cat <<'EOF' > cmd/reims-doctor/main.go
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"github.com/Nwflower/reims-go/internal/cli"
|
||||
)
|
||||
|
||||
func main() {
|
||||
os.Exit(cli.Main(os.Args[1:]))
|
||||
}
|
||||
EOF
|
||||
CGO_ENABLED=0 go build -o "$GITHUB_WORKSPACE/reims-go-cli" ./cmd/reims-doctor
|
||||
|
||||
- name: Validate registry & run static security gate
|
||||
id: gate
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
extra=""
|
||||
if [ -x "./reims-go-cli" ]; then
|
||||
extra="--reims-bin ./reims-go-cli"
|
||||
fi
|
||||
node scripts/build-index.mjs --check $extra --report pr-report.md
|
||||
|
||||
- name: Post gate report comment on PR
|
||||
if: always() && hashFiles('pr-report.md') != ''
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const body = fs.readFileSync('pr-report.md', 'utf8');
|
||||
const marker = '<!-- reims-go-plugin-gate -->';
|
||||
const fullBody = `${marker}\n${body}`;
|
||||
const { data: comments } = await github.rest.issues.listComments({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
});
|
||||
const existing = comments.find((c) => c.body && c.body.includes(marker));
|
||||
if (existing) {
|
||||
await github.rest.issues.updateComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
comment_id: existing.id,
|
||||
body: fullBody,
|
||||
});
|
||||
} else {
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
body: fullBody,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
name: Publish Market Index
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['main']
|
||||
paths:
|
||||
- 'registry.json'
|
||||
- 'withdrawn.json'
|
||||
- 'scripts/**'
|
||||
schedule:
|
||||
- cron: '0 4 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: publish-dist
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout plugins repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Check if registry has active plugins
|
||||
id: reg
|
||||
run: |
|
||||
count=$(node -e "const r = JSON.parse(require('fs').readFileSync('registry.json','utf8')); console.log((r.plugins||[]).length)")
|
||||
echo "count=$count" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Setup Go for reims-go doctor CLI
|
||||
if: steps.reg.outputs.count != '0'
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Build headless reims-go CLI from Nwflower/Reims-Go
|
||||
if: steps.reg.outputs.count != '0'
|
||||
run: |
|
||||
git clone --depth 1 https://github.com/Nwflower/Reims-Go.git /tmp/reims-go-src
|
||||
cd /tmp/reims-go-src
|
||||
mkdir -p cmd/reims-doctor
|
||||
cat <<'EOF' > cmd/reims-doctor/main.go
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"github.com/Nwflower/reims-go/internal/cli"
|
||||
)
|
||||
|
||||
func main() {
|
||||
os.Exit(cli.Main(os.Args[1:]))
|
||||
}
|
||||
EOF
|
||||
CGO_ENABLED=0 go build -o "$GITHUB_WORKSPACE/reims-go-cli" ./cmd/reims-doctor
|
||||
|
||||
- name: Build dist/index.json
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
extra=""
|
||||
if [ -x "./reims-go-cli" ]; then
|
||||
extra="--reims-bin ./reims-go-cli"
|
||||
fi
|
||||
node scripts/build-index.mjs $extra --out-dir dist
|
||||
|
||||
- name: Publish dist orphan branch
|
||||
run: |
|
||||
cd dist
|
||||
git init -b dist
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add index.json changes.json
|
||||
git commit -m "chore(dist): publish market index $(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||
git remote add origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
||||
git push --force origin dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in new issue
Block a user