|
| 1 | +name: Release images/helm chart |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - 'v*' |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + packages: write |
| 12 | + |
| 13 | +env: |
| 14 | + HELM_VERSION: 3.14.0 |
| 15 | + MISE_VERSION: 2025.12.13 |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +jobs: |
| 22 | + helm: |
| 23 | + runs-on: ubuntu-24.04 |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 |
| 27 | + |
| 28 | + - name: Setup Mise |
| 29 | + uses: jdx/mise-action@9dc7d5dd454262207dea3ab5a06a3df6afc8ff26 # v3.4.1 |
| 30 | + with: |
| 31 | + version: ${{ env.MISE_VERSION }} |
| 32 | + |
| 33 | + - name: Install Helm |
| 34 | + run: mise install helm |
| 35 | + |
| 36 | + - name: Configure Git |
| 37 | + run: | |
| 38 | + git config user.name "$GITHUB_ACTOR" |
| 39 | + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" |
| 40 | +
|
| 41 | + - name: Extract version |
| 42 | + id: version |
| 43 | + run: | |
| 44 | + RAW_VERSION="${GITHUB_REF_NAME}" |
| 45 | + echo "VERSION=$RAW_VERSION" >> $GITHUB_OUTPUT |
| 46 | +
|
| 47 | + - name: Login to GitHub Container Registry |
| 48 | + run: | |
| 49 | + helm registry login ghcr.io -u ${{ github.repository_owner }} -p ${{ secrets.GITHUB_TOKEN }} |
| 50 | +
|
| 51 | + - name: Package Helm chart |
| 52 | + run: | |
| 53 | + helm package charts/pod-deletion-cost-controller \ |
| 54 | + --version ${{ steps.version.outputs.VERSION }} \ |
| 55 | + --app-version ${{ steps.version.outputs.VERSION }} |
| 56 | +
|
| 57 | + - name: Push Helm chart to OCI registry |
| 58 | + run: | |
| 59 | + CHART_FILE=$(ls pod-deletion-cost-controller-*.tgz) |
| 60 | + helm push "$CHART_FILE" oci://ghcr.io/${{ github.repository }} |
| 61 | +
|
| 62 | + image: |
| 63 | + runs-on: ubuntu-24.04 |
| 64 | + steps: |
| 65 | + - name: Checkout |
| 66 | + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 |
| 67 | + |
| 68 | + - name: Set up QEMU |
| 69 | + uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # 3.7.0 |
| 70 | + |
| 71 | + - name: Set up Docker Buildx |
| 72 | + id: buildx |
| 73 | + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # 3.12.0 |
| 74 | + |
| 75 | + - name: Login to Github Packages |
| 76 | + uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # 3.6.0 |
| 77 | + with: |
| 78 | + registry: ghcr.io |
| 79 | + username: ${{ github.repository_owner }} |
| 80 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + |
| 82 | + - name: Docker meta for tag |
| 83 | + id: meta-tag |
| 84 | + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # 5.10.0 |
| 85 | + with: |
| 86 | + images: ghcr.io/${{ github.repository }} |
| 87 | + flavor: | |
| 88 | + latest=true |
| 89 | + tags: | |
| 90 | + type=ref,event=tag |
| 91 | +
|
| 92 | + - name: Build image and push to GitHub Container Registry |
| 93 | + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 6.18.0 |
| 94 | + id: docker_build |
| 95 | + with: |
| 96 | + context: . |
| 97 | + file: ./Dockerfile |
| 98 | + platforms: linux/amd64,linux/arm64 |
| 99 | + tags: ${{ steps.meta-tag.outputs.tags }} |
| 100 | + labels: ${{ steps.meta-tag.outputs.labels }} |
| 101 | + annotations: ${{ steps.meta-tag.outputs.annotations }} |
| 102 | + cache-from: type=gha |
| 103 | + cache-to: type=gha,mode=max |
| 104 | + push: true |
0 commit comments