Open jimschubert opened 4 years ago
I looked into this and it doesn't seem too bad. In openapi-generator, we can add a triggered build on release similar to this:
name: Trigger
on:
push:
branches: [ master ]
release:
types: [ published ]
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Set env
run: echo ::set-env name=CONTENT::$(cat ${GITHUB_WORKSPACE}/value.txt)
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1.0.0
with:
token: ${{ secrets.REPO_TOKEN }}
repository: jimschubert/poc-triggered-workflow-orchestrator
event-type: triggered-event
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "content": "${{env.CONTENT}}"}'
And respond to the event in this repo (or some orchestrating repo) like this:
# Example via https://github.com/marketplace/actions/repository-dispatch
name: Repository Dispatch
on:
repository_dispatch:
types:
- triggered-event
jobs:
myEvent:
runs-on: ubuntu-latest
steps:
# Runs a single command using the runners shell
- name: Details of Event
run: echo "REF=${{ github.event.client_payload.ref }} SHA=${{ github.event.client_payload.sha }} CONTENT=${{ github.event.client_payload.content }}"
Tested in https://github.com/jimschubert/poc-triggered-workflow and https://github.com/jimschubert/poc-triggered-workflow-orchestrator
Tracking item to update/build/test on openapi-generator releases. If successful, we can commit the new version and trigger a release.