Update README.md #1
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
# Triggered manually using as input the release e.g. v0.0.1 | |
name: Publish Helm Chart | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'deploy/helm/**' | |
- 'deploy/kubernetes/**' | |
push: | |
tags: | |
- "v*" | |
workflow_dispatch: # manually it will get the latest tag to publish the helm chart | |
env: | |
HELM_REP: helm-charts | |
GH_OWNER: khulnasoft-lab | |
CHART_DIR: deploy/helm/hooker | |
GO_VERSION: "1.18" | |
KIND_VERSION: "v0.12.0" | |
KIND_IMAGE: "kindest/node:v1.23.4@sha256:0e34f0d0fd448aa2f2819cfd74e99fe5793a6e4938b328f657c8e3f81ee0dfb9" | |
jobs: | |
publish-chart: | |
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
with: | |
fetch-depth: 0 | |
- name: Install Helm | |
uses: azure/[email protected] | |
with: | |
version: v3.6.0 | |
- name: Install chart-releaser | |
env: | |
VERSION: 1.3.0 | |
run: | | |
wget "https://github.com/helm/chart-releaser/releases/download/v${VERSION}/chart-releaser_${VERSION}_linux_amd64.tar.gz" | |
tar xzvf chart-releaser_${VERSION}_linux_amd64.tar.gz cr | |
- name: 'Action Get Latest Tag' | |
uses: 'actions-ecosystem/[email protected]' | |
id: 'get-latest-tag' | |
with: | |
semver_only: true | |
- name: 'Determine default bump' | |
id: 'bump' | |
run: | | |
LATEST_TAG=${{ steps.get-latest-tag.outputs.tag }} | |
if [ "$LATEST_TAG" = "v0.0.0" ]; then | |
echo "::set-output name=type::major" | |
else | |
echo "::set-output name=type::patch" | |
fi | |
- name: Package helm chart | |
run: | | |
RELEASE=${{ steps.get-latest-tag.outputs.tag }} | |
echo "Release ${RELEASE}" | |
helm package --app-version=${RELEASE} --version=${RELEASE} ${{ env.CHART_DIR }} -d .cr-release-packages | |
- name: Upload helm chart | |
# Failed with upload the same version: https://github.com/helm/chart-releaser/issues/101 | |
continue-on-error: true | |
## Upload the tar in the Releases repository | |
run: | | |
./cr upload -o ${{ env.GH_OWNER }} -r ${{ env.HELM_REP }} --token ${{ secrets.ORG_REPO_TOKEN }} -p .cr-release-packages | |
- name: Index helm chart | |
run: | | |
./cr index -o ${{ env.GH_OWNER }} -r ${{ env.HELM_REP }} -c https://${{ env.GH_OWNER }}.github.io/${{ env.HELM_REP }}/ -i index.yaml | |
- name: Push index file | |
uses: dmnemec/[email protected] | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.ORG_REPO_TOKEN }} | |
with: | |
source_file: 'index.yaml' | |
destination_repo: '${{ env.GH_OWNER }}/${{ env.HELM_REP }}' | |
destination_folder: '.' | |
destination_branch: 'gh-pages' | |
user_email: [email protected] | |
user_name: 'khulnasoft-bot' |