|
| 1 | +name: "Helm Chart Releaser" |
| 2 | +description: "Host a Helm charts repo on GitHub Pages" |
| 3 | +author: "The Helm authors" |
| 4 | +branding: |
| 5 | + color: blue |
| 6 | + icon: anchor |
| 7 | +inputs: |
| 8 | + version: |
| 9 | + description: "The chart-releaser version to use (default: v1.6.0)" |
| 10 | + required: false |
| 11 | + default: v1.6.0 |
| 12 | + config: |
| 13 | + description: "The relative path to the chart-releaser config file" |
| 14 | + required: false |
| 15 | + charts_dir: |
| 16 | + description: The charts directory |
| 17 | + required: false |
| 18 | + default: charts |
| 19 | + install_dir: |
| 20 | + description: "Where to install the cr tool" |
| 21 | + required: false |
| 22 | + install_only: |
| 23 | + description: "Just install cr tool" |
| 24 | + required: false |
| 25 | + skip_packaging: |
| 26 | + description: "Skip the packaging option (do your custom packaging before running this action)" |
| 27 | + required: false |
| 28 | + skip_existing: |
| 29 | + description: "Skip package upload if release exists" |
| 30 | + required: false |
| 31 | + mark_as_latest: |
| 32 | + description: Mark the created GitHub release as 'latest' |
| 33 | + required: false |
| 34 | + default: true |
| 35 | +outputs: |
| 36 | + changed_charts: |
| 37 | + 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." |
| 38 | + value: ${{ steps.release.outputs.changed_charts }} |
| 39 | + chart_version: |
| 40 | + description: "The version of the most recently generated charts; will be set even if no charts have been updated since the last run." |
| 41 | + value: ${{ steps.release.outputs.chart_version }} |
| 42 | + |
| 43 | +runs: |
| 44 | + using: composite |
| 45 | + steps: |
| 46 | + - id: release |
| 47 | + run: | |
| 48 | + owner=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY") |
| 49 | + repo=$(cut -d '/' -f 2 <<< "$GITHUB_REPOSITORY") |
| 50 | +
|
| 51 | + args=(--owner "$owner" --repo "$repo") |
| 52 | + args+=(--charts-dir "${{ inputs.charts_dir }}") |
| 53 | +
|
| 54 | + if [[ -n "${{ inputs.version }}" ]]; then |
| 55 | + args+=(--version "${{ inputs.version }}") |
| 56 | + fi |
| 57 | +
|
| 58 | + if [[ -n "${{ inputs.config }}" ]]; then |
| 59 | + args+=(--config "${{ inputs.config }}") |
| 60 | + fi |
| 61 | +
|
| 62 | + if [[ -z "${{ inputs.install_dir }}" ]]; then |
| 63 | + install="$RUNNER_TOOL_CACHE/cr/${{ inputs.version }}/$(uname -m)" |
| 64 | + echo "$install" >> "$GITHUB_PATH" |
| 65 | + args+=(--install-dir "$install") |
| 66 | + else |
| 67 | + echo ${{ inputs.install_dir }} >> "$GITHUB_PATH" |
| 68 | + args+=(--install-dir "${{ inputs.install_dir }}") |
| 69 | + fi |
| 70 | +
|
| 71 | + if [[ -n "${{ inputs.install_only }}" ]]; then |
| 72 | + args+=(--install-only "${{ inputs.install_only }}") |
| 73 | + fi |
| 74 | +
|
| 75 | + if [[ -n "${{ inputs.skip_packaging }}" ]]; then |
| 76 | + args+=(--skip-packaging "${{ inputs.skip_packaging }}") |
| 77 | + fi |
| 78 | +
|
| 79 | + if [[ -n "${{ inputs.skip_existing }}" ]]; then |
| 80 | + args+=(--skip-existing "${{ inputs.skip_existing }}") |
| 81 | + fi |
| 82 | +
|
| 83 | + if [[ -n "${{ inputs.mark_as_latest }}" ]]; then |
| 84 | + args+=(--mark-as-latest "${{ inputs.mark_as_latest }}") |
| 85 | + fi |
| 86 | +
|
| 87 | + "$GITHUB_ACTION_PATH/cr.sh" "${args[@]}" |
| 88 | +
|
| 89 | + if [[ -f changed_charts.txt ]]; then |
| 90 | + cat changed_charts.txt >> "$GITHUB_OUTPUT" |
| 91 | + fi |
| 92 | + if [[ -f chart_version.txt ]]; then |
| 93 | + cat chart_version.txt >> "$GITHUB_OUTPUT" |
| 94 | + fi |
| 95 | + rm -f changed_charts.txt chart_version.txt |
| 96 | + shell: bash |
0 commit comments