69 lines
1.8 KiB
YAML
69 lines
1.8 KiB
YAML
name: Release Chart
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- charts/**
|
|
- .cr.yaml
|
|
- .github/workflows/release-chart.yaml
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- 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/setup-helm@v4
|
|
|
|
- name: Run chart-releaser
|
|
uses: helm/chart-releaser-action@v1.7.0
|
|
with:
|
|
charts_dir: charts
|
|
config: .cr.yaml
|
|
skip_existing: true
|
|
env:
|
|
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
- name: Log in to GHCR
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Push chart to OCI registry
|
|
run: |
|
|
shopt -s nullglob
|
|
charts=(.cr-release-packages/*.tgz)
|
|
if [ ${#charts[@]} -eq 0 ]; then
|
|
echo "No packaged charts to push"
|
|
exit 0
|
|
fi
|
|
owner=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')
|
|
for chart in "${charts[@]}"; do
|
|
helm push "$chart" "oci://ghcr.io/${owner}/charts"
|
|
done
|
|
|
|
- name: Make OCI chart public
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
owner=$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')
|
|
gh api --method PATCH "/orgs/${owner}/packages/container/charts%2Fkloud-csi/visibility" -f visibility=public || true
|