forked from bitdeps/helm-oci-charts-releaser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
131 lines (117 loc) · 4.58 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Copyright The Helm Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "Helm OCI Charts Releaser"
description: "Publish multiple Helm charts into an OCI registry"
author: "dennybaa"
branding:
color: blue
icon: anchor
inputs:
version:
description: "The chart-releaser version to use (default: v3.13.2)"
required: false
default: v3.13.2
charts_dir:
description: The chart(s) directory
required: false
oci_registry:
description: The OCI registry host
required: true
oci_username:
description: The username used to login to the OCI registry
required: true
oci_password:
description: The OCI user's password
required: true
oci_path:
description: "Subpath for the chart in oci. (eg. 'oci://${oci_registry}/${oci_path}' instead of the default 'oci://${oci_registry}/')"
required: false
github_token:
description: "Github Actions token must be provided to manage release creation and update"
required: true
install_dir:
description: "Helm installation directory"
required: false
skip_helm_install:
description: "Just install helm tool and don't release any charts"
required: false
skip_dependencies:
description: "Skip dependency update during packaging"
required: false
skip_upload:
description: "Skip the chart package upload if the GithHub release exists"
required: false
mark_as_latest:
description: "Mark the created GitHub release as 'latest'"
required: false
default: true
tag_name_pattern:
description: "Specifies GitHub repository release naming pattern (ex. '{chartName}-chart')"
required: false
outputs:
changed_charts:
description: "A comma-separated list of charts that were released on this run. Will be an empty string if no updates were detected, will be unset if `--skip_packaging` is used: in the latter case your custom packaging step is responsible for setting its own outputs if you need them."
value: ${{ steps.release.outputs.changed_charts }}
chart_version:
description: "The version of the most recently generated charts; will be set even if no charts have been updated since the last run."
value: ${{ steps.release.outputs.chart_version }}
runs:
using: composite
steps:
- id: release
run: |
if [[ -n "${{ inputs.version }}" ]]; then
args+=(--version "${{ inputs.version }}")
fi
if [[ -n "${{ inputs.charts_dir }}" ]]; then
args+=(--charts-dir "${{ inputs.charts_dir }}")
fi
if [[ -n "${{ inputs.oci_registry }}" ]]; then
args+=(--oci-registry "${{ inputs.oci_registry }}")
fi
if [[ -n "${{ inputs.oci_username }}" ]]; then
args+=(--oci-username "${{ inputs.oci_username }}")
fi
if [[ -n "${{ inputs.oci_path }}" ]]; then
args+=(--oci-path "${{ inputs.oci_path }}")
fi
if [[ -n "${{ inputs.install_dir }}" ]]; then
args+=(--install-dir "${{ inputs.install_dir }}")
fi
if [[ -n "${{ inputs.skip_helm_install }}" ]]; then
args+=(--skip-helm-install "${{ inputs.skip_helm_install }}")
fi
if [[ -n "${{ inputs.skip_dependencies }}" ]]; then
args+=(--skip-dependencies "${{ inputs.skip_dependencies }}")
fi
if [[ -n "${{ inputs.skip_existing }}" ]]; then
args+=(--skip-existing "${{ inputs.skip_existing }}")
fi
if [[ -n "${{ inputs.mark_as_latest }}" ]]; then
args+=(--mark-as-latest "${{ inputs.mark_as_latest }}")
fi
if [[ -n "${{ inputs.tag_name_pattern }}" ]]; then
args+=(--tag-name-pattern "${{ inputs.tag_name_pattern }}")
fi
export GITHUB_TOKEN="${{ inputs.github_token }}"
export OCI_PASSWORD="${{ inputs.oci_password }}"
"$GITHUB_ACTION_PATH/cr.sh" "${args[@]}"
if [[ -f changed_charts.txt ]]; then
cat changed_charts.txt >> "$GITHUB_OUTPUT"
fi
if [[ -f chart_version.txt ]]; then
cat chart_version.txt >> "$GITHUB_OUTPUT"
fi
rm -f changed_charts.txt chart_version.txt
shell: bash