In case you want to make the workflow reusable and thus better maintainable, you can create a new dedicated repo and use a slightly adjusted version of the workflow above. Define that the job is triggered on workflow_call
(trigger when a new tag is pushed will still be defined in each extension repository itself).
Please note that you must make the workflow repository accessible from other repositories in the same organization. See this GitHub Doc for more information.
your-organization/flarum-workflow-example/.github/workflows/sync.yml
on:
workflow_call:
jobs:
sync:
name: Sync Extension
...
Now if you want to use this reusable workflow in a extension repository, you can include it like this:
your-organization/flarum-ext-example/.github/workflows/sync.yml
name: Extiverse
on:
push:
tags:
- '*'
jobs:
trigger-sync:
name: Invoke Workflow
uses: your-organization/flarum-workflow-example/.github/workflows/sync.yml@master
secrets: inherit
Again, please note that you have to set the secret either in each repository you want to use this workflow or at the organization level. AFAIK, you should be able to access either one with e.g.${{ secrets.EXTIVERSE_API_TOKEN }}
.
The secret must be an API token (i.e. api:read
) and not a composer token (e.g. composer:download
).