Switch repository to k0rdent #5
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 | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/release_charts.yaml" | |
- "helm/**" | |
workflow_dispatch: {} | |
permissions: | |
contents: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout git repo | |
uses: actions/checkout@v4 | |
# Only a single commit is fetched by default, not whole tree. | |
- name: Install Helm | |
uses: azure/setup-helm@v4 | |
- name: Install YQ | |
uses: mikefarah/yq@v4 | |
- name: Build charts | |
run: | | |
mkdir build | |
for dir in helm/* | |
do | |
yq '.dependencies[] | select(.repository | test("^https?://")) | |
| "helm repo add " + .name + " " + .repository' "$dir/Chart.yaml" | sh | |
helm dependency update "$dir" | |
helm package "$dir" | |
chart_name=$(yq .name "$dir/Chart.yaml") | |
mv $chart_name-*.tgz build/ | |
done | |
echo | |
echo "Built:" | |
ls build | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push charts to GHCR | |
run: | | |
repo=oci://ghcr.io/${{ github.repository }}/charts | |
for chart in build/* | |
do | |
echo | |
echo "Pushing $chart to $repo" | |
helm push "$chart" "$repo" | |
done |