Platform Application Manifest Dispatch Action
The Platform Application Manifest Dispatch GitHub Action structures the workflow dispatch your .platform repository makes available for updating application images and configurations.
What does it do?
When you trigger the action, the provided inputs are used to issue a workflow dispatch with the necessary information to update your .platform repository.
Details
Check out the Platform Application Manifest Dispatch GitHub Action repository for full details on configuration options and usage.
Manifest Repository Dispatch
If you are not building container images in this repository, you can skip the build and push application and containers steps and go straight to dispatching to the .platform repository.
Here is an example GitHub Action workflow that demonstrates how to dispatch manifest updates without building a container image.
# .github/workflows/deploy.yml
name: Dispatch Manifest Updates
on:
push:
branches: [main]
workflow_dispatch:
inputs:
environment:
description: 'Target environment'
required: true
type: choice
default: 'dev'
options:
- dev
- stg
- prd
jobs:
dispatch-update:
runs-on: ubuntu-latest
steps:
- name: Dispatch Manifest Updates
uses: p6m-actions/platform-application-manifest-dispatch@v1
with:
repository: ${{ github.repository }}
environment: ${{ github.event.inputs.environment || 'dev' }}
directory-name: ${{ github.event.repository.name }} # This places the application in a folder named after the repository kubernetes/{directory-name}/{environment}/kustomization.yaml
update-manifest-token: ${{ secrets.UPDATE_MANIFEST_TOKEN }} # When your GitHub Organization is powered by Ybor, this token is assigned and available automatically
platform-dispatch-url: ${{ vars.PLATFORM_DISPATCH_URL }} # When your GitHub Organization is powered by Ybor, this url is assigned and available automatically
# These are required, but since we are not updating the image, we can use placeholders
registry: 'docker'
image-name: 'ignored'
digest: 'app-repo-maintained'
Build Container Image and Dispatch
If you are building and pushing container images in your application repository, your GitHub Action workflow should have this shape.
# .github/workflows/build.yml
name: Build and Deploy
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: p6m-actions/docker-buildx-setup@v1
# Login to your dependency registries if needed
# Login to your container registry, keep in mind that this user will need push permissions
- name: Login to Docker Registry
uses: p6m-actions/docker-repository-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_IDENTITY_TOKEN }}
# If you are using a different method to build and push your images, replace this step accordingly
- name: Build and Push Docker Image
id: build-image
run: |
docker buildx build --platform linux/amd64,linux/arm64 -t ${{ env.ARTIFACTORY_REGISTRY }}/my-application:latest --push .
echo "digest=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ env.ARTIFACTORY_REGISTRY }}/my-application:latest | cut -d'@' -f2)" >> $GITHUB_OUTPUT
- name: Update Application Manifest
uses: p6m-actions/platform-application-manifest-dispatch@v1
with:
repository: ${{ github.repository }}
image-name: "my-application"
directory-name: ${{ github.event.repository.name }} # This places the application in a folder named after the repository kubernetes/{directory-name}/{environment}/kustomization.yaml
environment: "dev"
digest: ${{ steps.build-image.outputs.digest }} # This is the image digest from the container build step
update-manifest-token: ${{ secrets.UPDATE_MANIFEST_TOKEN }} # When your GitHub Organization is powered by Ybor, this token is assigned and available automatically
platform-dispatch-url: ${{ vars.PLATFORM_DISPATCH_URL }} # When your GitHub Organization is powered by Ybor, this url is assigned and available automatically