Add a GitHub workflow
This section shows you how to set up a workflow that listens for the event you send from the application repository. When the workflow receives the event, it commits the new image tag to the infrastructure repository.
Step 1: Download the workflow
Navigate to the root of your infrastructure repository (pirates-iac
) and run:
Choose receive_dispatch_event_and_commit_image_tag.yml
.
Rename the downloaded file to include the application environment and application name:
For example:
Step 2: Customize the workflow variables
Open the file you just downloaded.
Update the repository_dispatch
event to listen for the event that you're sending from the application repository:
on:
repository_dispatch:
- types: [image-tag-update]
+ types: [pirates-dev-treasures_image-tag-update]
Update the env
variables to match your setup. For production it's recommended to set CREATE_PR
to true
:
Double check that all paths and variables look correct.
Step 3: Try to run the workflow
Try to run the chain of workflows by building a new image. The receiving workflow will try to commit the changes, but it will fail because you've not configured a PAT and GPG key yet. The next section covers how to do this.