Skip to content

Commit 2921666

Browse files
authored
Merge pull request #20 from WojcikMM/issue-19-add-ability-to-setup-versions
Add ability to define version and app-version of created helm package
2 parents 783b78b + db9ffbd commit 2921666

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Inputs:
1616
* `linting` Toggle Helm linting, can be disabled by setting it to `off`
1717
* `commit_username` Explicitly specify username for commit back, default to `GITHUB_ACTOR`
1818
* `commit_email` Explicitly specify email for commit back, default to `GITHUB_ACTOR@users.noreply.github.com`
19+
* `app_version` Explicitly specify app version in package. If not defined then used chart values.
20+
* `chart_version` Explicitly specify chart version in package. If not defined then used chart values.
1921

2022
## Examples
2123

@@ -64,3 +66,22 @@ jobs:
6466
commit_username: johndoe
6567
commit_email: johndoe@example.com
6668
```
69+
Package chart with specified chart & app versions and push all charts in `./charts` dir to `gh-pages` branch:
70+
```yaml
71+
name: release
72+
on:
73+
push:
74+
tags: '*'
75+
76+
jobs:
77+
release:
78+
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/checkout@v2
81+
- name: Publish Helm charts
82+
uses: stefanprodan/helm-gh-pages@master
83+
with:
84+
token: ${{ secrets.GITHUB_TOKEN }}
85+
app_version: 1.16.0
86+
chart_version: 0.1.0
87+
```

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ inputs:
4040
description: "The email used for the commit user"
4141
required: false
4242
default: ${{ github.actor }}@users.noreply.github.com
43+
app_version:
44+
description: "Set the appVersion on the chart to this version"
45+
required: false
46+
chart_version:
47+
description: "Set the version on the chart to this version"
48+
required: false
4349
runs:
4450
using: 'docker'
4551
image: 'Dockerfile'
@@ -55,3 +61,5 @@ runs:
5561
- ${{ inputs.linting }}
5662
- ${{ inputs.commit_username }}
5763
- ${{ inputs.commit_email }}
64+
- ${{ inputs.app_version }}
65+
- ${{ inputs.chart_version }}

src/entrypoint.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ HELM_VERSION=$8
2828
LINTING=$9
2929
COMMIT_USERNAME=${10}
3030
COMMIT_EMAIL=${11}
31+
APP_VERSION=${12}
32+
CHART_VERSION=${13}
3133

3234
CHARTS=()
3335
CHARTS_TMP_DIR=$(mktemp -d)
@@ -123,7 +125,10 @@ lint() {
123125
}
124126

125127
package() {
126-
helm package ${CHARTS[*]} --destination ${CHARTS_TMP_DIR}
128+
[[ -z $APP_VERSION ]] || APP_VERSION_CMD=" --app-version $APP_VERSION";
129+
[[ -z $CHART_VERSION ]] || CHART_VERSION_CMD=" --version $CHART_VERSION"
130+
131+
helm package ${CHARTS[*]} --destination ${CHARTS_TMP_DIR} "$APP_VERSION_CMD" "$CHART_VERSION_CMD"
127132
}
128133

129134
upload() {

0 commit comments

Comments
 (0)