Created
May 18, 2022 05:47
-
-
Save joaomlneto/b3970c9f022f231c2bbf644a780ebe12 to your computer and use it in GitHub Desktop.
Publishing Helm Chart to private repository using GitHub Actions
This file contains hidden or 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
(...) | |
jobs: | |
package: | |
name: Package Helm Chart | |
runs-on: ubuntu-latest | |
outputs: | |
chart_filename: ${{ steps.chart_filename.outputs.chart_filename }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- 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/[email protected] | |
with: | |
version: v3.5.2 | |
- name: Package Helm Charts | |
run: helm package chart | |
- id: chart_filename | |
name: Output Chart Filename | |
run: echo "::set-output name=chart_filename::$(ls *.tgz)" | |
- name: Upload Helm Chart Package as Workflow Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ steps.chart_filename.outputs.chart_filename }} | |
path: ${{ steps.chart_filename.outputs.chart_filename }} | |
retention-days: 1 | |
if-no-files-found: error | |
publish: | |
name: Publish Helm Chart | |
runs-on: ubuntu-latest | |
needs: | |
- package | |
steps: | |
- name: Checkout Chart Repository | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ secrets.CHARTS_REPOSITORY }} # myorg/myrepo | |
token: ${{ secrets.PACKAGES_ACCESS_TOKEN }} | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Install Helm | |
uses: azure/[email protected] | |
with: | |
version: v3.5.2 | |
- name: Retrieve Chart Package Workflow Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: ${{ needs.package.outputs.chart_filename }} | |
- name: Add chart to repository | |
run: | | |
helm repo index . | |
git add . | |
git commit -m "Add ${{ needs.package.outputs.chart_filename }}" | |
git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment