Skip to content

v1.0.0

v1.0.0 #63

Workflow file for this run

---
name: "Release k6-operator"
permissions: {}
on:
workflow_dispatch:
inputs:
image_tag:
description: "Image tag name."
required: true
release:
types:
- published
jobs:
build:
name: "Build images"
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: "Build:checkout"
uses: actions/checkout@v4
with:
persist-credentials: false
- name: "Set image tag name"
env:
GH_IMAGE_TAG: ${{ github.event.inputs.image_tag }}
GH_TAG_NAME: ${{ github.event.release.tag_name }}
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "IMAGETAG=${GH_IMAGE_TAG}" >> $GITHUB_ENV
else
echo "IMAGETAG=${GH_TAG_NAME}" >> $GITHUB_ENV
fi
- name: "Check image tag name"
run: |
echo "IMAGETAG=${{env.IMAGETAG}}"
- name: Set up QEMU
# this is v3.6.0
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
- name: "Build:buildx"
# this is v3.10.0
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
with:
version: v0.9.1 # Buildx version
- name: "Build:login"
# this is v3.4.0
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Build:dockerimage"
# this is v6.16.0
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1
with:
context: .
push: true
file: Dockerfile.controller
build-args: |
GO_BUILDER_IMG=golang:1.25
platforms: linux/amd64,linux/arm64
tags: ghcr.io/grafana/k6-operator:latest,ghcr.io/grafana/k6-operator:controller-${{env.IMAGETAG}}
- name: "Build:dockerimage"
# this is v6.16.0
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1
with:
context: .
push: true
file: Dockerfile.runner
platforms: linux/amd64,linux/arm64
tags: ghcr.io/grafana/k6-operator:latest-runner,ghcr.io/grafana/k6-operator:runner-${{env.IMAGETAG}}
- name: "Build:dockerimage"
# this is v6.16.0
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1
with:
context: .
push: true
file: Dockerfile.starter
platforms: linux/amd64,linux/arm64
tags: ghcr.io/grafana/k6-operator:latest-starter,ghcr.io/grafana/k6-operator:starter-${{env.IMAGETAG}}
bundle:
name: "Generate bundle"
if: startsWith(github.ref_name, 'v')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
persist-credentials: true # this job is opening a PR in the next steps
- name: "Set image tag name"
env:
GH_IMAGE_TAG: ${{ github.event.inputs.image_tag }}
GH_TAG_NAME: ${{ github.event.release.tag_name }}
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "IMAGETAG=${GH_IMAGE_TAG}" >> $GITHUB_ENV
else
echo "IMAGETAG=${GH_TAG_NAME}" >> $GITHUB_ENV
fi
- name: "Setup kustomize"
# this is v2.1.0
uses: imranismail/setup-kustomize@2ba527d4d055ab63514ba50a99456fc35684947f
- name: "Bundle"
run: |
cd config/default && kustomize edit set image ghcr.io/grafana/k6-operator=*:controller-${{env.IMAGETAG}} && kustomize build . > ../../bundle.yaml
- name: "Branch"
run: |
git checkout -b release-${{env.IMAGETAG}}/bundle-update
git add bundle.yaml
git diff --cached | tee diff.file
echo "BUNDLE_DIFF=$(wc -c < diff.file)" >> "$GITHUB_OUTPUT"
- name: "Make PR"
if: ${{ steps.branch.BUNDLE_DIFF }} > 0
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m 'auto: bundle update for ${{env.IMAGETAG}}'
git push -u origin release-${{env.IMAGETAG}}/bundle-update
gh pr create --title "Bundle update for release ${{env.IMAGETAG}}" -B main -H release-${{env.IMAGETAG}}/bundle-update --body "Auto-generated by Github Workflow"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}