build arm64 version of operator (#19) #13
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- lightrun-init-agent/* | |
- .github/** | |
- helm-chart/* | |
- grafana/* | |
- config/* | |
- examples/* | |
- docs/* | |
- Makefile | |
jobs: | |
build: | |
name: Build and push Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
path: 'helm-repo' | |
ref: 'helm-repo' | |
fetch-depth: 0 | |
- name: Bump version and push tag | |
uses: anothrNick/[email protected] | |
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@v4 | |
with: | |
go-version: '1.20' | |
- name: Run tests and prepare reports | |
shell: bash | |
run: | | |
make test | |
- name: Install Helm | |
uses: azure/setup-helm@v1 | |
- 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: Login to DockerHub | |
if: ${{ success() }} | |
uses: docker/login-action@v2 | |
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@v3 | |
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/[email protected] | |
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 "[email protected]" | |
git add $(git ls-files -o --exclude-standard) | |
git add index.yaml | |
git commit -m "Updated from ref: $GITHUB_SHA" | |
git push | |