|
| 1 | +name: Publish Registry |
| 2 | + |
| 3 | +# Regenerates registry.json from registry-sources.json (reading each standalone |
| 4 | +# plugin repo's GitHub Releases) and uploads it to the GCS object that |
| 5 | +# production reads: gs://mf-plugins-prod/registry.json |
| 6 | +# |
| 7 | +# Triggers: |
| 8 | +# - workflow_dispatch: publish on demand (e.g. right after a plugin cuts a |
| 9 | +# new release in its own repo). |
| 10 | +# - push to main touching the sources/generator: republish when the plugin |
| 11 | +# list changes. |
| 12 | +# - schedule: a daily safety net so new plugin versions get picked up even if |
| 13 | +# no one triggers a manual run. |
| 14 | + |
| 15 | +on: |
| 16 | + workflow_dispatch: |
| 17 | + push: |
| 18 | + branches: [main] |
| 19 | + paths: |
| 20 | + - registry-sources.json |
| 21 | + - scripts/generate-registry.mjs |
| 22 | + - .github/workflows/publish-registry.yml |
| 23 | + schedule: |
| 24 | + - cron: "0 6 * * *" |
| 25 | + |
| 26 | +permissions: |
| 27 | + id-token: write |
| 28 | + contents: read |
| 29 | + |
| 30 | +concurrency: |
| 31 | + group: publish-registry |
| 32 | + cancel-in-progress: true |
| 33 | + |
| 34 | +jobs: |
| 35 | + publish: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + env: |
| 38 | + GCS_BUCKET: mf-plugins-prod |
| 39 | + REGISTRY_OBJECT: registry.json |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - uses: actions/setup-node@v4 |
| 44 | + with: |
| 45 | + node-version: 20 |
| 46 | + |
| 47 | + # generate-registry.mjs reads registry-sources.json and calls the GitHub |
| 48 | + # Releases API for each plugin repo. GITHUB_TOKEN raises the API rate |
| 49 | + # limit and covers public reads. |
| 50 | + - name: Generate registry.json |
| 51 | + env: |
| 52 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + run: npm run registry:generate |
| 54 | + |
| 55 | + - name: Authenticate to GCP |
| 56 | + uses: google-github-actions/auth@v2 |
| 57 | + with: |
| 58 | + workload_identity_provider: ${{ secrets.WIF_PROVIDER }} |
| 59 | + service_account: ${{ secrets.GCP_SA_EMAIL }} |
| 60 | + |
| 61 | + - uses: google-github-actions/setup-gcloud@v2 |
| 62 | + |
| 63 | + - name: Upload registry.json to GCS |
| 64 | + run: gcloud storage cp registry.json "gs://${GCS_BUCKET}/${REGISTRY_OBJECT}" |
0 commit comments