Skip to content

Commit

Permalink
Fix docs and add missing version input (#5)
Browse files Browse the repository at this point in the history
Signed-off-by: Reinhard Naegele <unguiculus@gmail.com>
  • Loading branch information
unguiculus authored Dec 9, 2019
1 parent be9c1b2 commit 590e9dd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Chart releaser action
# *chart-releaser* Action

A GitHub action to turn a GitHub project into a self-hosted Helm chart repo, using [helm/chart-releaser](https://github.com/helm/chart-releaser) CLI tool.

Expand All @@ -12,17 +12,18 @@ A GitHub action to turn a GitHub project into a self-hosted Helm chart repo, usi
* The token's user must have write access to the project
* To mitigate risk you may wish to limit the token to a single project by creating a [machine user](https://developer.github.com/v3/guides/managing-deploy-keys/#machine-users)
* Please note the personal access token is required because of an [Actions bug](https://git.luolix.topmunity/t5/GitHub-Actions/Github-action-not-triggering-gh-pages-upon-push/m-p/31266/highlight/true#M743), and will hopefully be unnecessary in the future
1. Create a workflow `.yml` file in your `.github/workflows` directory. An [example workflow](#example-workflow) is available below. For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file)
1. Create a workflow `.yml` file in your `.github/workflows` directory. An [example workflow](#example-workflow) is available below.
For more information, reference the GitHub Help Documentation for [Creating a workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file)

### Inputs

For more information on inputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#input)

- `version`: The chart-releaser version to use (default: v0.2.3)
- `charts-dir`: The charts directory
- `charts-repo-url`: The GitHub Pages URL to the charts repo (default: `https://<owner>.github.io/<project>`)
- `token`: The GitHub token

### Example workflow
### Example Workflow

Create a workflow (eg: `.github/workflows/release.yml`):

Expand All @@ -43,16 +44,17 @@ jobs:

- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email noreply@github.com
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.0.0-alpha.1
env:
CR_TOKEN: "${{ secrets.CR_TOKEN }}"
```
This uses [@helm/chart-releaser-action](https://www.github.com/helm/chart-releaser-action) to turn your GitHub project into a self-hosted Helm chart repo. It does this – during every push to `master` – by checking each chart in your project, and whenever there's a new chart version, creates a corresponding [GitHub release](https://help.github.com/en/github/administering-a-repository/about-releases) named for the chart version, adds Helm chart artifacts to the release, and creates or updates an `index.yaml` file with metadata about those releases, which is then hosted on GitHub Pages
This uses [@helm/chart-releaser-action](https://www.github.com/helm/chart-releaser-action) to turn your GitHub project into a self-hosted Helm chart repo.
It does this – during every push to `master` – by checking each chart in your project, and whenever there's a new chart version, creates a corresponding [GitHub release](https://help.github.com/en/github/administering-a-repository/about-releases) named for the chart version, adds Helm chart artifacts to the release, and creates or updates an `index.yaml` file with metadata about those releases, which is then hosted on GitHub Pages

## Code of conduct

Expand Down
6 changes: 4 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: "Helm Chart Releaser"
description: "Host a Helm charts repo on GitHub Pages"
author: "The Helm authors"
branding:
color: anchor
icon: check-circle
color: blue
icon: anchor
inputs:
version:
description: "The chart-releaser version to use (default: v0.2.3)"
charts_dir:
description: The charts directory
default: charts
Expand Down
2 changes: 1 addition & 1 deletion cr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ cat << EOF
Usage: $(basename "$0") <options>
-h, --help Display help
-v, --version The kind version to use (default: v0.2.3)"
-v, --version The chart-releaser version to use (default: v0.2.3)"
-d, --charts-dir The charts directory (defaut: charts)
-u, --charts-repo-url The GitHub Pages URL to the charts repo (default: https://<owner>.github.io/<repo>)
-o, --owner The repo owner
Expand Down
4 changes: 4 additions & 0 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ main() {
args=(--owner "$owner" --repo "$repo")
args+=(--charts-dir "${INPUT_CHARTS_DIR?Input 'charts_dir' is required}")

if [[ -n "${INPUT_VERSION:-}" ]]; then
args+=(--version "${INPUT_VERSION}")
fi

if [[ -n "${INPUT_CHARTS_REPO_URL:-}" ]]; then
args+=(--charts-repo-url "${INPUT_CHARTS_REPO_URL}")
fi
Expand Down

0 comments on commit 590e9dd

Please sign in to comment.