Skip to content

Commit

Permalink
Add changed_charts and chart_version outputs (#130)
Browse files Browse the repository at this point in the history
* Add `changed_charts` and `chart_version` outputs

This should let downstream steps make conditional decisions
based on what we found.

Also: fix a confusing double-negative test in main().

Signed-off-by: Nathan J. Mehl <n@oden.io>

---------

Signed-off-by: Nathan J. Mehl <n@oden.io>
  • Loading branch information
n-oden authored Jul 11, 2023
1 parent 4b85f2c commit 2504907
Show file tree
Hide file tree
Showing 3 changed files with 257 additions and 229 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ A GitHub action to turn a GitHub project into a self-hosted Helm chart repo, usi
- `skip_packaging`: This option, when populated, will skip the packaging step. This allows you to do more advanced packaging of your charts (for example, with the `helm package` command) before this action runs. This action will only handle the indexing and publishing steps.
- `mark_as_latest`: When you set this to `false`, it will mark the created GitHub release not as 'latest'.

### Outputs

- `changed_charts`: 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.
- `chart_version`: The version of the most recently generated charts; will be set even if no charts have been updated since the last run.

### Environment variables

- `CR_TOKEN` (required): The GitHub token of this repository (`${{ secrets.GITHUB_TOKEN }}`)
Expand Down
18 changes: 17 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@ inputs:
description: Mark the created GitHub release as 'latest'
required: false
default: true
outputs:
changed_charts:
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."
value: ${{ steps.release.outputs.changed_charts }}
chart_version:
description: "The version of the most recently generated charts; will be set even if no charts have been updated since the last run."
value: ${{ steps.release.outputs.chart_version }}

runs:
using: composite
steps:
- run: |
- id: release
run: |
owner=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY")
repo=$(cut -d '/' -f 2 <<< "$GITHUB_REPOSITORY")
Expand Down Expand Up @@ -77,4 +85,12 @@ runs:
fi
"$GITHUB_ACTION_PATH/cr.sh" "${args[@]}"
if [[ -f changed_charts.txt ]]; then
cat changed_charts.txt >> "$GITHUB_OUTPUT"
fi
if [[ -f chart_version.txt ]]; then
cat chart_version.txt >> "$GITHUB_OUTPUT"
fi
rm -f changed_charts.txt chart_version.txt
shell: bash
Loading

0 comments on commit 2504907

Please sign in to comment.