Skip to content

Merge pull request #50 from grafana/fix-build-api #11

Merge pull request #50 from grafana/fix-build-api

Merge pull request #50 from grafana/fix-build-api #11

Workflow file for this run

name: publish
on:
push:
branches:
- main
tags:
- v*
env:
REGISTRY: ghcr.io
IMAGE_NAME: grafana/k6build
jobs:
publish-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3
with:
version: v0.9.1
- name: Log into ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
run: |
if [[ "$GITHUB_REF_TYPE" == "tag" ]]; then
IMAGE_VERSION=$GITHUB_REF_NAME
else
IMAGE_VERSION='latest'
fi
IMAGE_TAG="$REGISTRY/$IMAGE_NAME:${IMAGE_VERSION}"
docker buildx build -t $IMAGE_TAG --platform=linux/amd64,linux/arm64 --push .