Add target_dir option
Signed-off-by: Steven Sheehy <steven.sheehy@hedera.com>
This commit is contained in:
parent
a6d2694382
commit
ade295d5a3
3 changed files with 16 additions and 4 deletions
|
@ -12,6 +12,7 @@ Inputs:
|
|||
* `repository` The GitHub repository, defaults to the `GITHUB_REPOSITORY` env var
|
||||
* `branch` The branch to publish charts, defaults to `gh-pages`
|
||||
* `helm_version` The Helm CLI version, defaults to the latest release
|
||||
* `target_dir` The target directory to store the charts, defaults to `.`
|
||||
|
||||
## Examples
|
||||
|
||||
|
@ -56,4 +57,5 @@ jobs:
|
|||
owner: fluxcd
|
||||
repository: charts
|
||||
branch: gh-pages
|
||||
target_dir: charts
|
||||
```
|
||||
|
|
|
@ -26,6 +26,9 @@ inputs:
|
|||
helm_version:
|
||||
description: "The Helm CLI version"
|
||||
required: false
|
||||
target_dir:
|
||||
description: "The target directory to store the charts, defaults to `.`"
|
||||
required: false
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
|
@ -36,4 +39,5 @@ runs:
|
|||
- ${{ inputs.user }}
|
||||
- ${{ inputs.repository }}
|
||||
- ${{ inputs.branch }}
|
||||
- ${{ inputs.helm_version }}
|
||||
- ${{ inputs.helm_version }}
|
||||
- ${{ inputs.target_dir }}
|
||||
|
|
|
@ -10,6 +10,7 @@ OWNER=$4
|
|||
REPOSITORY=$5
|
||||
BRANCH=$6
|
||||
HELM_VERSION=$7
|
||||
TARGET_DIR=$8
|
||||
|
||||
CHARTS=()
|
||||
CHARTS_TMP_DIR=$(mktemp -d)
|
||||
|
@ -37,6 +38,10 @@ main() {
|
|||
BRANCH="gh-pages"
|
||||
fi
|
||||
|
||||
if [[ -z "$TARGET_DIR" ]]; then
|
||||
TARGET_DIR="."
|
||||
fi
|
||||
|
||||
if [[ -z "$CHARTS_URL" ]]; then
|
||||
CHARTS_URL="https://${OWNER}.github.io/${REPOSITORY}"
|
||||
fi
|
||||
|
@ -103,10 +108,11 @@ upload() {
|
|||
|
||||
charts=$(cd ${CHARTS_TMP_DIR} && ls *.tgz | xargs)
|
||||
|
||||
mv -f ${CHARTS_TMP_DIR}/*.tgz .
|
||||
helm repo index . --url ${CHARTS_URL}
|
||||
mkdir -p ${TARGET_DIR}
|
||||
mv -f ${CHARTS_TMP_DIR}/*.tgz ${TARGET_DIR}
|
||||
helm repo index ${TARGET_DIR} --url ${CHARTS_URL}
|
||||
|
||||
git add .
|
||||
git add ${TARGET_DIR}
|
||||
git commit -m "Publish $charts"
|
||||
git push origin gh-pages
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue