Skip to content

Commit 12f5926

Browse files
authored
Merge pull request #27 from clenimar/master
add INDEX_DIR argument
2 parents d7b0068 + 05a64d0 commit 12f5926

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Inputs:
1818
* `commit_email` Explicitly specify email for commit back, default to `GITHUB_ACTOR@users.noreply.github.com`
1919
* `app_version` Explicitly specify app version in package. If not defined then used chart values.
2020
* `chart_version` Explicitly specify chart version in package. If not defined then used chart values.
21+
* `index_dir` The location of `index.yaml` file in the repo, defaults to the same value as `target_dir`
2122

2223
## Examples
2324

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ inputs:
4646
chart_version:
4747
description: "Set the version on the chart to this version"
4848
required: false
49+
index_dir:
50+
description: "The location of `index.yaml` file in the repo, defaults to the same value as `target_dir`"
51+
required: false
4952
runs:
5053
using: 'docker'
5154
image: 'Dockerfile'
@@ -63,3 +66,4 @@ runs:
6366
- ${{ inputs.commit_email }}
6467
- ${{ inputs.app_version }}
6568
- ${{ inputs.chart_version }}
69+
- ${{ inputs.index_dir }}

src/entrypoint.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ COMMIT_USERNAME=${10}
3030
COMMIT_EMAIL=${11}
3131
APP_VERSION=${12}
3232
CHART_VERSION=${13}
33+
INDEX_DIR=${14}
3334

3435
CHARTS=()
3536
CHARTS_TMP_DIR=$(mktemp -d)
@@ -81,6 +82,10 @@ main() {
8182
COMMIT_EMAIL="${GITHUB_ACTOR}@users.noreply.github.com"
8283
fi
8384

85+
if [[ -z "$INDEX_DIR" ]]; then
86+
INDEX_DIR=${TARGET_DIR}
87+
fi
88+
8489
locate
8590
download
8691
dependencies
@@ -151,18 +156,20 @@ upload() {
151156

152157
mkdir -p ${TARGET_DIR}
153158

154-
if [[ -f "${TARGET_DIR}/index.yaml" ]]; then
159+
if [[ -f "${INDEX_DIR}/index.yaml" ]]; then
155160
echo "Found index, merging changes"
156-
helm repo index ${CHARTS_TMP_DIR} --url ${CHARTS_URL} --merge "${TARGET_DIR}/index.yaml"
161+
helm repo index ${CHARTS_TMP_DIR} --url ${CHARTS_URL} --merge "${INDEX_DIR}/index.yaml"
157162
mv -f ${CHARTS_TMP_DIR}/*.tgz ${TARGET_DIR}
158-
mv -f ${CHARTS_TMP_DIR}/index.yaml ${TARGET_DIR}/index.yaml
163+
mv -f ${CHARTS_TMP_DIR}/index.yaml ${INDEX_DIR}/index.yaml
159164
else
160165
echo "No index found, generating a new one"
161166
mv -f ${CHARTS_TMP_DIR}/*.tgz ${TARGET_DIR}
162-
helm repo index ${TARGET_DIR} --url ${CHARTS_URL}
167+
helm repo index ${INDEX_DIR} --url ${CHARTS_URL}
163168
fi
164169

165170
git add ${TARGET_DIR}
171+
git add ${INDEX_DIR}/index.yaml
172+
166173
git commit -m "Publish $charts"
167174
git push origin ${BRANCH}
168175

0 commit comments

Comments
 (0)