update chart release action to use CR release v1.4.0 (#106)
* update chart release action to use CR release v1.4.0 Signed-off-by: cpanato <ctadeu@gmail.com> * update based on review Signed-off-by: cpanato <ctadeu@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@ name: test-chart-releaser
|
|||||||
on: [pull_request]
|
on: [pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test_chart_releaser_action:
|
test_chart_releaser_install_action:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
actions: none
|
actions: none
|
||||||
@@ -21,13 +21,42 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Install chart-releaser
|
- name: Install chart-releaser
|
||||||
uses: ./
|
uses: ./
|
||||||
|
with:
|
||||||
|
install_only: true
|
||||||
|
env:
|
||||||
|
CR_TOKEN: "FAKE_SECRETS"
|
||||||
- name: Check install!
|
- name: Check install!
|
||||||
run: cr version
|
run: cr version
|
||||||
- name: Check root directory
|
- name: Check root directory
|
||||||
run: |
|
run: |
|
||||||
if [[ $(git diff --stat) != '' ]]; then
|
if ! git diff --stat --exit-code; then
|
||||||
|
echo 'should be clean'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
test_chart_releaser_action:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: none
|
||||||
|
checks: none
|
||||||
|
contents: none
|
||||||
|
deployments: none
|
||||||
|
issues: none
|
||||||
|
packages: none
|
||||||
|
pull-requests: none
|
||||||
|
repository-projects: none
|
||||||
|
security-events: none
|
||||||
|
statuses: none
|
||||||
|
name: Install chart-releaser and run it
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install chart-releaser
|
||||||
|
uses: ./
|
||||||
|
env:
|
||||||
|
CR_TOKEN: "FAKE_SECRETS"
|
||||||
|
- name: Check root directory
|
||||||
|
run: |
|
||||||
|
if ! git diff --stat --exit-code; then
|
||||||
echo 'should be clean'
|
echo 'should be clean'
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ A GitHub action to turn a GitHub project into a self-hosted Helm chart repo, usi
|
|||||||
|
|
||||||
### Pre-requisites
|
### Pre-requisites
|
||||||
|
|
||||||
1. A GitHub repo containing a directory with your Helm charts (default is a folder named `/charts`, if you want to
|
1. A GitHub repo containing a directory with your Helm charts (default is a folder named `/charts`, if you want to
|
||||||
maintain your charts in a different directory, you must include a `charts_dir` input in the workflow).
|
maintain your charts in a different directory, you must include a `charts_dir` input in the workflow).
|
||||||
1. A GitHub branch called `gh-pages` to store the published charts. See `charts_repo_url` for alternatives.
|
1. A GitHub branch called `gh-pages` to store the published charts. See `charts_repo_url` for alternatives.
|
||||||
1. In your repo, go to Settings/Pages. Change the `Source` `Branch` to `gh-pages`.
|
1. In your repo, go to Settings/Pages. Change the `Source` `Branch` to `gh-pages`.
|
||||||
@@ -15,7 +15,7 @@ maintain your charts in a different directory, you must include a `charts_dir` i
|
|||||||
|
|
||||||
### Inputs
|
### Inputs
|
||||||
|
|
||||||
- `version`: The chart-releaser version to use (default: v1.3.0)
|
- `version`: The chart-releaser version to use (default: v1.4.0)
|
||||||
- `config`: Optional config file for chart-releaser. For more information on the config file, see the [documentation](https://github.com/helm/chart-releaser#config-file)
|
- `config`: Optional config file for chart-releaser. For more information on the config file, see the [documentation](https://github.com/helm/chart-releaser#config-file)
|
||||||
- `charts_dir`: The charts directory
|
- `charts_dir`: The charts directory
|
||||||
- `charts_repo_url`: The GitHub Pages URL to the charts repo (default: `https://<owner>.github.io/<project>`)
|
- `charts_repo_url`: The GitHub Pages URL to the charts repo (default: `https://<owner>.github.io/<project>`)
|
||||||
@@ -55,10 +55,10 @@ jobs:
|
|||||||
- name: Install Helm
|
- name: Install Helm
|
||||||
uses: azure/setup-helm@v1
|
uses: azure/setup-helm@v1
|
||||||
with:
|
with:
|
||||||
version: v3.7.1
|
version: v3.8.1
|
||||||
|
|
||||||
- name: Run chart-releaser
|
- name: Run chart-releaser
|
||||||
uses: helm/chart-releaser-action@v1.3.0
|
uses: helm/chart-releaser-action@v1.4.0
|
||||||
env:
|
env:
|
||||||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
```
|
```
|
||||||
@@ -71,7 +71,7 @@ It does this – during every push to `main` – by checking each chart in your
|
|||||||
`workflow.yml`:
|
`workflow.yml`:
|
||||||
```yaml
|
```yaml
|
||||||
- name: Run chart-releaser
|
- name: Run chart-releaser
|
||||||
uses: helm/chart-releaser-action@v1.2.0
|
uses: helm/chart-releaser-action@v1.4.0
|
||||||
with:
|
with:
|
||||||
charts_dir: charts
|
charts_dir: charts
|
||||||
config: cr.yaml
|
config: cr.yaml
|
||||||
@@ -81,6 +81,7 @@ It does this – during every push to `main` – by checking each chart in your
|
|||||||
```
|
```
|
||||||
|
|
||||||
`cr.yaml`:
|
`cr.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
owner: myaccount
|
owner: myaccount
|
||||||
git-base-url: https://api.github.com/
|
git-base-url: https://api.github.com/
|
||||||
|
|||||||
+26
-1
@@ -6,14 +6,26 @@ branding:
|
|||||||
icon: anchor
|
icon: anchor
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: "The chart-releaser version to use (default: v1.3.0)"
|
description: "The chart-releaser version to use (default: v1.4.0)"
|
||||||
|
required: false
|
||||||
|
default: v1.4.0
|
||||||
config:
|
config:
|
||||||
description: "The relative path to the chart-releaser config file"
|
description: "The relative path to the chart-releaser config file"
|
||||||
|
required: false
|
||||||
charts_dir:
|
charts_dir:
|
||||||
description: The charts directory
|
description: The charts directory
|
||||||
|
required: false
|
||||||
default: charts
|
default: charts
|
||||||
charts_repo_url:
|
charts_repo_url:
|
||||||
description: "The GitHub Pages URL to the charts repo (default: https://<owner>.github.io/<repo>)"
|
description: "The GitHub Pages URL to the charts repo (default: https://<owner>.github.io/<repo>)"
|
||||||
|
required: false
|
||||||
|
install_dir:
|
||||||
|
description: 'Where to install the cr tool'
|
||||||
|
required: false
|
||||||
|
install_only:
|
||||||
|
description: 'Just install cr tool'
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
@@ -36,5 +48,18 @@ runs:
|
|||||||
args+=(--charts-repo-url "${{ inputs.charts_repo_url }}")
|
args+=(--charts-repo-url "${{ inputs.charts_repo_url }}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${{ inputs.install_dir }}" ]]; then
|
||||||
|
install="$RUNNER_TOOL_CACHE/cr/${{ inputs.version }}/$(uname -m)"
|
||||||
|
echo "$install" >> "$GITHUB_PATH"
|
||||||
|
args+=(--install-dir "$install")
|
||||||
|
else
|
||||||
|
echo ${{ inputs.install_dir }} >> "$GITHUB_PATH"
|
||||||
|
args+=(--install-dir "${{ inputs.install_dir }}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${{ inputs.install_only }}" ]]; then
|
||||||
|
args+=(--install-only "${{ inputs.install_only }}")
|
||||||
|
fi
|
||||||
|
|
||||||
"$GITHUB_ACTION_PATH/cr.sh" "${args[@]}"
|
"$GITHUB_ACTION_PATH/cr.sh" "${args[@]}"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ set -o errexit
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
DEFAULT_CHART_RELEASER_VERSION=v1.3.0
|
DEFAULT_CHART_RELEASER_VERSION=v1.4.0
|
||||||
|
|
||||||
show_help() {
|
show_help() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
@@ -31,6 +31,8 @@ Usage: $(basename "$0") <options>
|
|||||||
-u, --charts-repo-url The GitHub Pages URL to the charts repo (default: https://<owner>.github.io/<repo>)
|
-u, --charts-repo-url The GitHub Pages URL to the charts repo (default: https://<owner>.github.io/<repo>)
|
||||||
-o, --owner The repo owner
|
-o, --owner The repo owner
|
||||||
-r, --repo The repo name
|
-r, --repo The repo name
|
||||||
|
-n, --install-dir The Path to install the cr tool
|
||||||
|
-i, --install-only Just install the cr tool
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,6 +43,8 @@ main() {
|
|||||||
local owner=
|
local owner=
|
||||||
local repo=
|
local repo=
|
||||||
local charts_repo_url=
|
local charts_repo_url=
|
||||||
|
local install_dir=
|
||||||
|
local install_only=
|
||||||
|
|
||||||
parse_command_line "$@"
|
parse_command_line "$@"
|
||||||
|
|
||||||
@@ -151,6 +155,18 @@ parse_command_line() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
-n|--install-dir)
|
||||||
|
if [[ -n "${2:-}" ]]; then
|
||||||
|
install_dir="$2"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
-i|--install-only)
|
||||||
|
if [[ -n "${2:-}" ]]; then
|
||||||
|
install_only="$2"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
@@ -174,6 +190,18 @@ parse_command_line() {
|
|||||||
if [[ -z "$charts_repo_url" ]]; then
|
if [[ -z "$charts_repo_url" ]]; then
|
||||||
charts_repo_url="https://$owner.github.io/$repo"
|
charts_repo_url="https://$owner.github.io/$repo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$install_dir" ]]; then
|
||||||
|
local arch
|
||||||
|
arch=$(uname -m)
|
||||||
|
install_dir="$RUNNER_TOOL_CACHE/cr/$version/$arch"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$install_only" ]]; then
|
||||||
|
echo "Will install cr tool and not run it..."
|
||||||
|
install_chart_releaser
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_chart_releaser() {
|
install_chart_releaser() {
|
||||||
@@ -182,21 +210,17 @@ install_chart_releaser() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local arch
|
if [[ ! -d "$install_dir" ]]; then
|
||||||
arch=$(uname -m)
|
mkdir -p "$install_dir"
|
||||||
|
|
||||||
local cache_dir="$RUNNER_TOOL_CACHE/ct/$version/$arch"
|
echo "Installing chart-releaser on $install_dir..."
|
||||||
if [[ ! -d "$cache_dir" ]]; then
|
|
||||||
mkdir -p "$cache_dir"
|
|
||||||
|
|
||||||
echo "Installing chart-releaser..."
|
|
||||||
curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/$version/chart-releaser_${version#v}_linux_amd64.tar.gz"
|
curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/$version/chart-releaser_${version#v}_linux_amd64.tar.gz"
|
||||||
tar -xzf cr.tar.gz -C "$cache_dir"
|
tar -xzf cr.tar.gz -C "$install_dir"
|
||||||
rm -f cr.tar.gz
|
rm -f cr.tar.gz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo 'Adding cr directory to PATH...'
|
echo 'Adding cr directory to PATH...'
|
||||||
export PATH="$cache_dir:$PATH"
|
export PATH="$install_dir:$PATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
lookup_latest_tag() {
|
lookup_latest_tag() {
|
||||||
|
|||||||
Reference in New Issue
Block a user