87 lines
2.4 KiB
YAML
87 lines
2.4 KiB
YAML
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 }}
|