Skip to content

v0.0.11rc1

v0.0.11rc1 #41

Workflow file for this run

---
name: "push"
on:
workflow_dispatch:
inputs:
image_tag:
description: 'Image tag name.'
required: true
release:
types:
- published
jobs:
build:
name: "Build images"
runs-on: ubuntu-latest
steps:
- name: "Build:checkout"
uses: actions/checkout@v2
- name: "Set image tag name"
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "IMAGETAG=${{ github.event.inputs.image_tag }}" >> $GITHUB_ENV
else
echo "IMAGETAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
fi
- name: "Check image tag name"
run: |
echo "IMAGETAG=${{env.IMAGETAG}}"
- name: "Build:buildx"
uses: docker/setup-buildx-action@v1
with:
version: v0.9.1 # Buildx version
- name: "Build:login"
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Build:dockerimage"
uses: docker/build-push-action@v2
with:
context: .
push: true
file: Dockerfile.controller
build-args: |
GO_BUILDER_IMG=golang:1.18
tags: ghcr.io/grafana/k6-operator:latest,ghcr.io/grafana/k6-operator:controller-${{env.IMAGETAG}}
- name: "Build:dockerimage"
uses: docker/build-push-action@v2
with:
context: .
push: true
file: Dockerfile.runner
tags: ghcr.io/grafana/k6-operator:latest-runner,ghcr.io/grafana/k6-operator:runner-${{env.IMAGETAG}}
- name: "Build:dockerimage"
uses: docker/build-push-action@v2
with:
context: .
push: true
file: Dockerfile.starter
tags: ghcr.io/grafana/k6-operator:latest-starter,ghcr.io/grafana/k6-operator:starter-${{env.IMAGETAG}}
bundle:
name: "Generate bundle"
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: "Checkout code"
uses: actions/checkout@v2
- name: "Set image tag name"
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "IMAGETAG=${{ github.event.inputs.image_tag }}" >> $GITHUB_ENV
else
echo "IMAGETAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
fi
- name: "Setup kustomize"
uses: imranismail/setup-kustomize@v2
- 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 }}