Section 4 - The deploy reusable workflow
Creating the reusable workflow job
Setting up the reusable workflow files
Refactoring the build and push workflow
name: test-build-deploy
on:
workflow_call:
inputs:
...
deploy-commit:
required: false
type: boolean
description: "Commit changes to deploy"
default: ${{ github.event_name != 'pull_request' }}
deploy-create-pr:
required: false
type: boolean
description: "Create PR for deploy"
default: ${{ github.event_name != 'pull_request' }}
jobs:
test:
...
build:
...
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: checkout
uses: actions/checkout@v4
- name: Update deployment.yaml
uses: fjogeleit/yaml-update-action@v1
with:
valueFile: 'deploy/deployment.yaml'
propertyPath: 'spec.template.spec.containers[0].image'
value: ghcr.io/${{ inputs.image-owner }}/${{ inputs.image-name }}:${{ github.sha }}
commitChange: ${{ inputs.deploy-commit }}
targetBranch: main
masterBranchName: main
createPR: ${{ inputs.deploy-create-pr }}
branch: 'reusable/deploy'
token: ${{ secrets.GITHUB_TOKEN }}
message: 'Update Image Version to: ${{ github.sha }}'
PreviousSection 3 - The build and push reusable workflowNextSection 5 - Releasing the reusable workflow
Last updated