forked from bitcoin-sv/bux-k8s-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
69 lines (65 loc) · 3.33 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: "Update version"
description: "Checking bux version"
inputs:
deployment_file:
required: true
description: 'Path to deployment file from which image should be compared against newest tag version'
dockerhub_user:
required: false
description: 'Dockerhub username, required for private repositories'
dockerhub_password:
required: false
description: 'Dockerhub password/token, required for private repositories'
pr:
required: false
description: 'Should component be updated by creating a PR (default true)'
default: "true"
runs:
using: "composite"
steps:
- name: "Check version"
id: check-version
uses: ./.github/actions/check-version
with:
deployment_file: ${{ inputs.deployment_file }}
dockerhub_user: ${{ inputs.dockerhub_user }}
dockerhub_password: ${{ inputs.dockerhub_password }}
- name: "Update version"
if: success() && steps.check-version.outputs.hasNewerImage == 'true'
uses: mikefarah/yq@master
with:
cmd: yq -i '.spec.template.spec.containers[0].image = "${{steps.check-version.outputs.image}}:${{steps.check-version.outputs.latestVersion}}"' ${{ inputs.deployment_file }}
- name: "Create Pull Request"
if: inputs.pr == 'true' && success() && steps.check-version.outputs.hasNewerImage == 'true'
id: cpr
uses: peter-evans/create-pull-request@v5
with:
commit-message: "feat: update ${{steps.check-version.outputs.image}} in ${{steps.check-version.outputs.name}} to ${{steps.check-version.outputs.latestVersion}}"
committer: GitHub <[email protected]>
author: 4ChainBot <[email protected]>
branch: update-${{steps.check-version.outputs.name}}
delete-branch: true
title: "feat: update ${{steps.check-version.outputs.image}} in ${{steps.check-version.outputs.name}} to ${{steps.check-version.outputs.latestVersion}}"
body: |
This is PR automatically created because of release of ${{steps.check-version.outputs.image}} ${{steps.check-version.outputs.latestVersion}}
labels: |
automated pr
draft: false
- name: "Commit & Push"
if: inputs.pr == 'false' && success() && steps.check-version.outputs.hasNewerImage == 'true'
uses: EndBug/add-and-commit@v9
with:
add: ${{inputs.deployment_file}}
message: "feat: update ${{steps.check-version.outputs.image}} in ${{steps.check-version.outputs.name}} to ${{steps.check-version.outputs.latestVersion}}"
# Determines the way the action fills missing author name and email. Three options are available:
# - github_actor -> UserName <[email protected]>
# - user_info -> Your Display Name <[email protected]>
# - github_actions -> github-actions <email associated with the github logo>
# Default: github_actor
default_author: github_actions
# The way the action should handle pathspec errors from the add and remove commands. Three options are available:
# - ignore -> errors will be logged but the step won't fail
# - exitImmediately -> the action will stop right away, and the step will fail
# - exitAtEnd -> the action will go on, every pathspec error will be logged at the end, the step will fail.
# Default: ignore
pathspec_error_handling: exitImmediately