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: Checkout Reims-Go CLI source if: steps.reg.outputs.count != '0' uses: actions/checkout@v4 with: repository: Nwflower/Reims-Go ref: main path: reims-go - name: Setup Go from Reims-Go go.mod if: steps.reg.outputs.count != '0' uses: actions/setup-go@v5 with: go-version-file: reims-go/go.mod - name: Build headless reims-go CLI if: steps.reg.outputs.count != '0' run: | cd reims-go 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 }} REIMS_GO_PLATFORM: windows-x64 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 }}