Release Charts #303
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: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
chart_version: | |
type: string | |
description: "helm chart version that this release" | |
required: true | |
default: "v1.0.5-nightly" | |
chart_app_version: | |
type: string | |
description: "helm chart appVersion for this release" | |
required: true | |
default: "v1.0.5-nightly" | |
overwrite_existing_release_assets_if_applicable: | |
type: boolean | |
description: "Should Overwrite Existing Release Assets, if applicable" | |
required: false | |
default: false | |
prerelease: | |
type: boolean | |
description: "should this release be marked as pre-release" | |
required: false | |
default: true | |
permissions: | |
contents: write | |
id-token: write | |
pages: write | |
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 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
- name: Install Helm | |
uses: azure/setup-helm@v4 | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- name: Installing yq (with pip) | |
run: |+ | |
pip install yq | |
- name: Add repositories | |
run: | | |
for dir in $(ls -d charts/*); do | |
pushd $dir | |
helm dependency list 2> /dev/null | tail +2 | head -n -1 | awk '{ print "helm repo add " $1 " " $3 }' | while read cmd; do $cmd; done | |
helm dependency update | |
popd | |
done | |
- name: Setting up Chart Releaser | |
run: |+ | |
curl -L0 https://github.com/helm/chart-releaser/releases/download/v1.5.0/chart-releaser_1.5.0_linux_amd64.tar.gz > /tmp/chart-releaser.tar.gz && tar xf /tmp/chart-releaser.tar.gz -C /tmp && mv /tmp/cr /usr/local/bin/cr | |
# - name: Installing Github Cli | |
# run: |+ | |
# curl -L0 https://github.com/cli/cli/releases/download/v2.29.0/gh_2.29.0_linux_amd64.tar.gz > /tmp/gh_2.29.0_linux_amd64.tar.gz && tar xf /tmp/gh_2.29.0_linux_amd64.tar.gz -C /tmp && mv /tmp/gh_2.29.0_linux_amd64/bin/gh /usr/local/bin/gh | |
- name: update version and appVersion in charts' Chart.yaml | |
env: | |
CHART_VERSION: ${{ github.event.inputs.chart_version }} | |
APP_VERSION: ${{ github.event.inputs.chart_app_version }} | |
run: |+ | |
for dir in $(ls -d charts/*); do | |
pushd $dir | |
sed -i "s/^version:.*/version: ${CHART_VERSION}/g" Chart.yaml | |
sed -i "s/^appVersion:.*/appVersion: ${APP_VERSION}/g" Chart.yaml | |
popd | |
done | |
- name: Releasing Helm Charts | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
CHART_VERSION: ${{github.event.inputs.chart_version}} | |
PRE_RELEASE: ${{ github.event.inputs.prerelease }} | |
OVERWRITE_RELEASE_ASSETS: ${{ github.event.inputs.overwrite_existing_release_assets_if_applicable }} | |
HELM_MERGE_WITH_EXISTING_RELEASES: ${{ github.event.inputs.helm_merge_with_existing_indexes }} | |
RELEASE_TITLE: "kloudlite-helm-charts" | |
GITHUB_REPO_OWNER: ${{github.repository_owner}} | |
GITHUB_REPO_NAME: ${{github.event.repository.name}} | |
shell: bash | |
run: |+ | |
bash scripts/release-script.sh | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: github-pages | |
path: .static-pages | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: release | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |