mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-07 22:53:55 -05:00
105 lines
4.0 KiB
YAML
105 lines
4.0 KiB
YAML
name: Release K8 Operator Docker Image
|
|
on:
|
|
push:
|
|
tags:
|
|
- "infisical-k8-operator/v*.*.*"
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
release-image:
|
|
name: Generate Helm Chart PR
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
pr_number: ${{ steps.create-pr.outputs.pull-request-number }}
|
|
steps:
|
|
- name: Extract version from tag
|
|
id: extract_version
|
|
run: echo "::set-output name=version::${GITHUB_REF_NAME#infisical-k8-operator/}"
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
# Dependency for helm generation
|
|
- name: Install Helm
|
|
uses: azure/setup-helm@v3
|
|
with:
|
|
version: v3.10.0
|
|
|
|
# Dependency for helm generation
|
|
- name: Install Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: 1.21
|
|
|
|
# Install binaries for helm generation
|
|
- name: Install dependencies
|
|
working-directory: k8-operator
|
|
run: |
|
|
make helmify
|
|
make kustomize
|
|
make controller-gen
|
|
|
|
- name: Generate Helm Chart
|
|
working-directory: k8-operator
|
|
run: make helm VERSION=${{ steps.extract_version.outputs.version }}
|
|
|
|
- name: Debug - Check file changes
|
|
run: |
|
|
echo "Current git status:"
|
|
git status
|
|
echo ""
|
|
echo "Modified files:"
|
|
git diff --name-only
|
|
|
|
# If there is no diff, exit with error. Version should always be changed, so if there is no diff, something is wrong and we should exit.
|
|
if [ -z "$(git diff --name-only)" ]; then
|
|
echo "No helm changes or version changes. Invalid release detected, Exiting."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Create Helm Chart PR
|
|
id: create-pr
|
|
uses: peter-evans/create-pull-request@v5
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
commit-message: "Update Helm chart to version ${{ steps.extract_version.outputs.version }}"
|
|
committer: GitHub <noreply@github.com>
|
|
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
|
branch: helm-update-${{ steps.extract_version.outputs.version }}
|
|
delete-branch: true
|
|
title: "Update Helm chart to version ${{ steps.extract_version.outputs.version }}"
|
|
body: |
|
|
This PR updates the Helm chart to version `${{ steps.extract_version.outputs.version }}`.
|
|
Additionally the helm chart has been updated to match the latest operator code changes.
|
|
|
|
Associated Release Workflow: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
|
|
Once you have approved this PR, you can trigger the helm release workflow manually.
|
|
base: main
|
|
|
|
- name: 🔧 Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
- name: 🔧 Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: 🐋 Login to Docker Hub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Build and push
|
|
id: docker_build
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: k8-operator
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: |
|
|
infisical/kubernetes-operator:latest
|
|
infisical/kubernetes-operator:${{ steps.extract_version.outputs.version }}
|