|
| 1 | +name: Publish Helm Chart to GCP Artifact Registry |
| 2 | +description: Publish Helm chart to GCP Artifact Registry |
| 3 | +inputs: |
| 4 | + gcp-credentials: |
| 5 | + required: true |
| 6 | + description: "GCP Service Account JSON key" |
| 7 | + gcp-project-id: |
| 8 | + required: true |
| 9 | + description: "GCP Project ID" |
| 10 | + gcp-region: |
| 11 | + required: true |
| 12 | + description: "GCP Region" |
| 13 | + gcp-artifact-repo: |
| 14 | + required: true |
| 15 | + description: "GCP Artifact Container Registry name" |
| 16 | + chart-path: |
| 17 | + required: false |
| 18 | + description: "Path to the Helm chart" |
| 19 | + default: ${{ github.workspace }}/charts |
| 20 | + chart-name: |
| 21 | + required: true |
| 22 | + description: "Helm chart name" |
| 23 | + chart-version: |
| 24 | + required: true |
| 25 | + description: "Helm chart version" |
| 26 | +runs: |
| 27 | + using: "composite" |
| 28 | + steps: |
| 29 | + - uses: google-github-actions/auth@v2 |
| 30 | + with: |
| 31 | + credentials_json: ${{ inputs.gcp-credentials }} |
| 32 | + |
| 33 | + - uses: google-github-actions/setup-gcloud@v2 |
| 34 | + with: |
| 35 | + project_id: ${{ inputs.gcp-project-id }} |
| 36 | + |
| 37 | + - name: Configure Docker auth for Artifact Registry |
| 38 | + shell: bash |
| 39 | + run: | |
| 40 | + gcloud auth configure-docker ${{ inputs.gcp-region }}-docker.pkg.dev |
| 41 | +
|
| 42 | + - name: Install Helm |
| 43 | + shell: bash |
| 44 | + run: | |
| 45 | + curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash |
| 46 | +
|
| 47 | + - name: Update Helm chart dependencies |
| 48 | + shell: bash |
| 49 | + run: | |
| 50 | + helm dependency update ${{ inputs.chart-path }} |
| 51 | +
|
| 52 | + - name: Package Helm chart |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + helm package ${{ inputs.chart-path }} |
| 56 | +
|
| 57 | + - name: Define chart full path |
| 58 | + shell: bash |
| 59 | + run: | |
| 60 | + echo "CHART_FULL_PATH=${{ inputs.gcp-region }}-docker.pkg.dev/${{ inputs.gcp-project-id }}/${{ inputs.gcp-artifact-repo }}/${{ inputs.chart-name }}" >> $GITHUB_ENV |
| 61 | +
|
| 62 | + - name: Push Helm chart to Artifact Registry |
| 63 | + shell: bash |
| 64 | + run: | |
| 65 | + helm push ${{ github.workspace }}/${{ inputs.chart-name }}-${{ inputs.chart-version }}.tgz oci://${{ env.CHART_FULL_PATH }} |
0 commit comments