helm-chart-push #39
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: Helm Chart Package and Push to Artifactory | |
on: | |
repository_dispatch: | |
types: | |
- helm-chart-push | |
workflow_dispatch: | |
inputs: | |
image_tag: | |
description: 'Docker Image Tag' | |
required: true | |
default: '1.65.0' | |
chart_version: | |
description: 'Helm Chart Version' | |
required: true | |
default: '1.65.0' | |
chart_name: | |
description: 'Helm Chart Name' | |
required: true | |
default: 'governor' | |
jobs: | |
helm: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./charts | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Helm | |
uses: Azure/[email protected] | |
with: | |
version: v3.11.0 | |
id: install | |
- name: Extract Image Tag and Chart Version | |
id: extract_tags | |
run: | | |
if [ -z "${{ github.event.client_payload.image_tag }}" ]; then | |
echo "IMAGE_TAG=${{ github.event.inputs.image_tag }}" >> $GITHUB_ENV | |
echo "CHART_VERSION=${{ github.event.inputs.chart_version }}" >> $GITHUB_ENV | |
echo "CHART_NAME=${{ github.event.inputs.chart_name }}" >> $GITHUB_ENV | |
else | |
echo "IMAGE_TAG=${{ github.event.client_payload.image_tag }}" >> $GITHUB_ENV | |
echo "CHART_VERSION=${{ github.event.client_payload.chart_version }}" >> $GITHUB_ENV | |
echo "CHART_NAME=${{ github.event.client_payload.chart_name }}" >> $GITHUB_ENV | |
fi | |
- name: Package Helm chart with Image Tag | |
run: | | |
helm package ${{ env.CHART_NAME }} --version ${{ env.CHART_VERSION }} --app-version ${{ env.IMAGE_TAG }} | |
- name: Helm login && push to oci jfrog artifactory registry | |
run: | | |
helm registry login https://${{ vars.ARTIFACTORY_DOMAIN }} \ | |
-u ${{ secrets.ARTIFACTORY_LOGIN }} -p ${{ secrets.ARTIFACTORY_PWD }} | |
helm push ${{ env.CHART_NAME }}-${{ env.CHART_VERSION }}.tgz oci://${{ vars.ARTIFACTORY_DOMAIN }}/helm |