DeployNow
...
Advanced Deployment Options
CI/CD with GitHub Actions

Image Updater Action

A GitHub action to update values in an existing YAML or JSON file. Given key and the updated value for the key to be updated, this action writes the newly provided value for the given key. The action can update the value in the following two ways:

  1. Update the file in the existing branch (which is generally main)
  2. Create a new branch from the source branch (which is generally main), update the value for the given key, and raise the PR to the target branch.

Use Cases

Update manifests repo (Helm Chart) after building a new Docker image

Update the image version configuration inside helm values.yaml after building docker image.

Snippet

YAML


Input Arguments

Base Configurations

Argument

Description

Default

repository

Repository URL where the manifests are present



valueFile

relative path from the Workspace Directory



propertyPath

Path of the key for which the value should be updated



value

New value that should be updated for the propertyPath



branch

The updated YAML file will be committed to this branch, branch will be created if not exists

master

createPR

Create a PR from branch to targetBranch. Use true to enable it

true

message

Commit message

' '

token

GitHub Token which is used to create the PR.

NOTE: The token should have right permissions for the selected repository.



workDir

Relative location of the configured repository

.

masterBranchName

The branch name of the primary branch

master

targetBranch

The branch for which a PR gets created from branch

NOTE: If this setting is enabled, it opens a PR from branch to targetBranch if createPR is set to true

master

force

Allows force pushes

false

updateFile

(deprecated) The updated content will be written into the actual file by default

false

commitUserName

Name used for the commit userName used for the commit user



github-actions[bot]

commitUserEmail

Email address used for the commit user

41898282+github-actions[bot]@users.noreply.github.com

Examples

Sync an Application

To sync an application in the DeployNow instance automatically (without any manual intervention), use the following example:



YAML


The aforementioned example commits the value of ${{ env.SHORT_SHA }} to helloworldapi.image.tag key of the values.yaml file.

Here is the values.yaml file for reverence:

YAML


NOTE: SHORT_SHA will be set in the docker image build step.

It is recommended to give GITHUB_TOKEN as repo secrets. Directly committing the raw secrets to GitHub is not a good security measure.