Skip to content

chore: Update protobuf #26

chore: Update protobuf

chore: Update protobuf #26

Workflow file for this run

name: Build
on:
push:
branches:
- main
release:
types:
- published
pull_request:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Get release tag
if: github.event_name == 'release'
run: echo "RELEASE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build Go binary amd64
run: go build -ldflags "-s -w -X main.GitCommit=$GITHUB_SHA -X main.GitRef=$GITHUB_REF -X main.Version=${RELEASE_TAG:-commit-$GITHUB_SHA}" -o bin/gpu-metrics-exporter-amd64 ./cmd/main.go
env:
GOOS: linux
GOARCH: amd64
CGO_ENABLED: 0
- name: Build Go binary arm64
run: go build -ldflags "-s -w -X main.GitCommit=$GITHUB_SHA -X main.GitRef=$GITHUB_REF -X main.Version=${RELEASE_TAG:-commit-$GITHUB_SHA}" -o bin/gpu-metrics-exporter-arm64 ./cmd/main.go
env:
GOOS: linux
GOARCH: arm64
CGO_ENABLED: 0
- name: Test
run: go test -race ./...
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push PR
if: ${{ github.event_name == 'pull_request' }}
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64,linux/amd64
file: ./Dockerfile
push: true
tags: ghcr.io/castai/gpu-metrics-exporter/gpu-metrics-exporter:${{ github.sha }}
- name: Build and push main
if: ${{ github.event_name != 'pull_request' && github.event_name != 'release' }}
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64,linux/amd64
file: ./Dockerfile
push: true
tags: ghcr.io/castai/gpu-metrics-exporter/gpu-metrics-exporter:${{ github.sha }}
- name: Build and push release
if: ${{ github.event_name == 'release' }}
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/arm64,linux/amd64
file: ./Dockerfile
tags: |
ghcr.io/castai/gpu-metrics-exporter/gpu-metrics-exporter:${{ env.RELEASE_TAG }}
ghcr.io/castai/gpu-metrics-exporter/gpu-metrics-exporter:latest