Skip to content

Merge pull request #31 from lightrun-platform/DEVOPS-2134-add-lightru… #21

Merge pull request #31 from lightrun-platform/DEVOPS-2134-add-lightru…

Merge pull request #31 from lightrun-platform/DEVOPS-2134-add-lightru… #21

Workflow file for this run

name: "Release"
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- lightrun-init-agent/*
- .github/**
- helm-chart/*
- charts/*
- grafana/*
- config/*
- examples/*
- docs/*
- Makefile
jobs:
build:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout
uses: actions/checkout@v4
with:
path: "helm-repo"
ref: "helm-repo"
fetch-depth: 0
- name: Bump version and push tag
uses: anothrNick/github-tag-action@1.67.0
id: release_tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BUMP: patch
VERBOSE: true
WITH_V: false
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Run tests and prepare reports
shell: bash
run: |
make test
- name: Install Helm
uses: azure/setup-helm@v4
- name: Pack Helm chart
shell: bash
run: |
yq -i '.version = "${{steps.release_tag.outputs.new_tag}}"' helm-chart/Chart.yaml
yq -i '.controllerManager.manager.image.tag = "${{steps.release_tag.outputs.new_tag}}"' helm-chart/values.yaml
helm package ./helm-chart -u -d ./helm-repo/
- name: Pack Lightrun Agents Helm chart
shell: bash
run: |
yq -i '.version = "${{steps.release_tag.outputs.new_tag}}"' charts/lightrun-agents/Chart.yaml
helm package ./charts/lightrun-agents -u -d ./helm-repo/
- name: Login to DockerHub
if: ${{ success() }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/arm64,linux/amd64
tags: |
lightruncom/lightrun-k8s-operator:${{steps.release_tag.outputs.new_tag}}
lightruncom/lightrun-k8s-operator:latest
- name: Create Release
if: ${{ success() }}
uses: ncipollo/release-action@v1.14.0
with:
artifacts: helm-repo/lightrun-k8s-operator-${{steps.release_tag.outputs.new_tag}}.tgz
tag: ${{steps.release_tag.outputs.new_tag}}
generateReleaseNotes: true
- name: Publish new chart version
shell: bash
working-directory: helm-repo
run: |
git switch helm-repo
helm repo index . --url https://lightrun-platform.github.io/lightrun-k8s-operator
git config user.name "Helm Updater"
git config user.email "actions@users.noreply.github.com"
git add $(git ls-files -o --exclude-standard)
git add index.yaml
git commit -m "Updated from ref: $GITHUB_SHA"
git push