feat: updated k8sgpt crd (#565) #421
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: release | |
on: | |
push: | |
branches: | |
- main | |
- '[0-9]+.[0-9]+.x' | |
workflow_dispatch: | |
env: | |
# Default minimum version of Go to support. | |
DEFAULT_GO_VERSION: 1.19 | |
REGISTRY: ghcr.io | |
GITHUB_PAGES_BRANCH: gh_pages | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
release-please: | |
permissions: | |
contents: write # for google-github-actions/release-please-action to create release commit | |
pull-requests: write # for google-github-actions/release-please-action to create release PR | |
runs-on: ubuntu-latest | |
outputs: | |
releases_created: ${{ steps.release.outputs.releases_created }} | |
tag_name: ${{ steps.release.outputs.tag_name }} | |
# Release-please creates a PR that tracks all changes | |
steps: | |
- name: Checkout | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | |
- uses: google-github-actions/release-please-action@e4dc86ba9405554aeba3c6bb2d169500e7d3b4ee # v4 | |
id: release | |
with: | |
command: manifest | |
token: ${{secrets.GITHUB_TOKEN}} | |
default-branch: main | |
release-charts: | |
needs: release-please | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
if: needs.release-please.outputs.releases_created == 'true' | |
steps: | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | |
- name: Publish Helm chart | |
uses: stefanprodan/helm-gh-pages@master | |
with: | |
token: ${{ secrets.K8SGPT_BOT_SECRET }} | |
charts_dir: chart | |
charts_url: https://charts.k8sgpt.ai | |
owner: k8sgpt-ai | |
repository: charts | |
branch: main | |
commit_username: k8sgpt-ai-bot | |
commit_email: [email protected] | |
build-container: | |
if: needs.release-please.outputs.releases_created == 'true' | |
needs: | |
- release-please | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: write | |
packages: write | |
id-token: write | |
env: | |
IMAGE_TAG: ghcr.io/k8sgpt-ai/k8sgpt-operator:${{ needs.release-please.outputs.tag_name }} | |
IMAGE_NAME: k8sgpt-operator | |
steps: | |
- name: Checkout | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 | |
with: | |
registry: "ghcr.io" | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker Image | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
target: production | |
tags: | | |
${{ env.IMAGE_TAG }} | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
cache-from: type=gha,scope=${{ github.ref_name }}-${{ env.IMAGE_TAG }} | |
cache-to: type=gha,scope=${{ github.ref_name }}-${{ env.IMAGE_TAG }} | |
- name: Generate SBOM | |
uses: anchore/sbom-action@55dc4ee22412511ee8c3142cbea40418e6cec693 # v0.17.8 | |
with: | |
image: ${{ env.IMAGE_TAG }} | |
artifact-name: sbom-${{ env.IMAGE_NAME }} | |
output-file: ./sbom-${{ env.IMAGE_NAME }}.spdx.json | |
- name: Attach SBOM to release | |
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2 | |
with: | |
tag_name: ${{ needs.release-please.outputs.tag_name }} | |
files: ./sbom-${{ env.IMAGE_NAME }}.spdx.json |