Test upload #11
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: Publish Helm Charts to GHCR | |
on: | |
push: | |
branches: | |
- master | |
# paths: | |
# - 'stable/**' | |
jobs: | |
package-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.16.2 | |
- name: Authenticate with GitHub Container Registry | |
env: | |
CR_PAT: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin | |
- name: Package and Push Helm Charts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
for chart_dir in stable/*; do | |
if [ -d "$chart_dir" ]; then | |
# Update dependencies | |
helm dependency update "$chart_dir" | |
# Package the Helm chart | |
helm package "$chart_dir" --destination packaged_charts | |
# Push the packaged chart to GitHub Container Registry | |
CHART_FILE=$(ls packaged_charts/*.tgz | tail -n 1) | |
helm push "$CHART_FILE" "oci://ghcr.io/${{ github.repository_owner }}/charts" | |
fi | |
done |