Added support for PRs in chartReleaser workflow #64
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Charts | |
on: | |
release: | |
types: | |
- published | |
pull_request: | |
paths: | |
- 'helm/**' | |
workflow_dispatch: | |
inputs: | |
chart_version: | |
description: 'The chart version to create. Will be appended to the current version from Chart.yaml (eg. "pr36" on Chart.yaml version: 5.1.2 produces "5.1.2-pr36").' | |
required: true | |
jobs: | |
release: | |
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions | |
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token | |
env: | |
CHART_VERSION: "${{ (github.event_name == 'workflow_dispatch' && format('-{0}', github.event.inputs.chart_version)) || (github.event_name == 'pull_request' && format('-pr{0}', github.event.pull_request.number)) }}" | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get helm chart version | |
id: chart | |
run: "echo \"version=$(helm show chart helm | grep 'version:' | tail -1 | cut -f2 -d' ')\" >> $GITHUB_OUTPUT" | |
- name: Publish Helm charts | |
uses: stefanprodan/helm-gh-pages@master | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
charts_dir: ./ | |
branch: gh-pages | |
target_dir: helm | |
chart_version: ${{ format('{0}{1}', steps.chart.outputs.version, env.CHART_VERSION || '') }} |