|
| 1 | +name: Release Helm Charts |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - 'charts/gardener-extension-provider-ironcore/**' |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + helm-chart: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + permissions: |
| 15 | + contents: read |
| 16 | + packages: write |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + fetch-depth: 0 |
| 22 | + |
| 23 | + - name: Set up Helm |
| 24 | + uses: azure/setup-helm@v4 |
| 25 | + with: |
| 26 | + version: v3.16.2 |
| 27 | + |
| 28 | + - name: Determine chart version |
| 29 | + id: chart_version |
| 30 | + run: | |
| 31 | + if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then |
| 32 | + # Use SHA for main branch |
| 33 | + CHART_VERSION="0.0.0-$(echo ${{ github.sha }} | cut -c1-7)" |
| 34 | + elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 35 | + # Use tag version (strip 'v' prefix) |
| 36 | + CHART_VERSION="${GITHUB_REF#refs/tags/v}" |
| 37 | + else |
| 38 | + # Use PR SHA for dry run |
| 39 | + CHART_VERSION="0.0.0-$(echo ${{ github.sha }} | cut -c1-7)" |
| 40 | + fi |
| 41 | + echo "version=$CHART_VERSION" >> $GITHUB_OUTPUT |
| 42 | +
|
| 43 | + - name: Log in to GitHub Container Registry |
| 44 | + run: | |
| 45 | + echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin |
| 46 | +
|
| 47 | + - name: Package provider Helm chart |
| 48 | + run: | |
| 49 | + helm package charts/gardener-extension-provider-ironcore --version ${{ steps.chart_version.outputs.version }} |
| 50 | +
|
| 51 | + - name: Push provider Helm chart to GHCR |
| 52 | + run: | |
| 53 | + helm push gardener-extension-provider-ironcore-${{ steps.chart_version.outputs.version }}.tgz oci://ghcr.io/${{ github.repository_owner }}/charts |
| 54 | +
|
| 55 | + - name: Package admission Helm chart |
| 56 | + run: | |
| 57 | + helm package charts/gardener-extension-admission-ironcore --version ${{ steps.chart_version.outputs.version }} |
| 58 | +
|
| 59 | + - name: Push admission Helm chart to GHCR |
| 60 | + run: | |
| 61 | + helm push gardener-extension-admission-ironcore-${{ steps.chart_version.outputs.version }}.tgz oci://ghcr.io/${{ github.repository_owner }}/charts |
0 commit comments