Skip to content

Commit ade295d

Browse files
committed
Add target_dir option
Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com>
1 parent a6d2694 commit ade295d

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Inputs:
1212
* `repository` The GitHub repository, defaults to the `GITHUB_REPOSITORY` env var
1313
* `branch` The branch to publish charts, defaults to `gh-pages`
1414
* `helm_version` The Helm CLI version, defaults to the latest release
15+
* `target_dir` The target directory to store the charts, defaults to `.`
1516

1617
## Examples
1718

@@ -56,4 +57,5 @@ jobs:
5657
owner: fluxcd
5758
repository: charts
5859
branch: gh-pages
60+
target_dir: charts
5961
```

action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ inputs:
2626
helm_version:
2727
description: "The Helm CLI version"
2828
required: false
29+
target_dir:
30+
description: "The target directory to store the charts, defaults to `.`"
31+
required: false
2932
runs:
3033
using: 'docker'
3134
image: 'Dockerfile'
@@ -36,4 +39,5 @@ runs:
3639
- ${{ inputs.user }}
3740
- ${{ inputs.repository }}
3841
- ${{ inputs.branch }}
39-
- ${{ inputs.helm_version }}
42+
- ${{ inputs.helm_version }}
43+
- ${{ inputs.target_dir }}

src/entrypoint.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ OWNER=$4
1010
REPOSITORY=$5
1111
BRANCH=$6
1212
HELM_VERSION=$7
13+
TARGET_DIR=$8
1314

1415
CHARTS=()
1516
CHARTS_TMP_DIR=$(mktemp -d)
@@ -37,6 +38,10 @@ main() {
3738
BRANCH="gh-pages"
3839
fi
3940

41+
if [[ -z "$TARGET_DIR" ]]; then
42+
TARGET_DIR="."
43+
fi
44+
4045
if [[ -z "$CHARTS_URL" ]]; then
4146
CHARTS_URL="https://${OWNER}.github.io/${REPOSITORY}"
4247
fi
@@ -103,10 +108,11 @@ upload() {
103108

104109
charts=$(cd ${CHARTS_TMP_DIR} && ls *.tgz | xargs)
105110

106-
mv -f ${CHARTS_TMP_DIR}/*.tgz .
107-
helm repo index . --url ${CHARTS_URL}
111+
mkdir -p ${TARGET_DIR}
112+
mv -f ${CHARTS_TMP_DIR}/*.tgz ${TARGET_DIR}
113+
helm repo index ${TARGET_DIR} --url ${CHARTS_URL}
108114

109-
git add .
115+
git add ${TARGET_DIR}
110116
git commit -m "Publish $charts"
111117
git push origin gh-pages
112118

0 commit comments

Comments
 (0)