Skip to content

Fix https://github.com/alcounit/browser-controller/issues/8 #28

Fix https://github.com/alcounit/browser-controller/issues/8

Fix https://github.com/alcounit/browser-controller/issues/8 #28

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: ["main"]
release:
types: [published]
permissions:
contents: read
jobs:
test:
name: Go tests (fmt/vet/tidy/test)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run quality checks + unit tests
run: |
make tidy
make fmt
make vet
make test
docker:
name: Build & Push Docker image (release only)
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Checkout (release tag)
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install codegen tools
run: |
set -euo pipefail
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.5
go install k8s.io/code-generator/cmd/client-gen@v0.35.0
go install k8s.io/code-generator/cmd/lister-gen@v0.35.0
go install k8s.io/code-generator/cmd/informer-gen@v0.35.0
go install k8s.io/code-generator/cmd/deepcopy-gen@v0.35.0
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Set image tag (VERSION) from release tag
id: meta
shell: bash
run: |
set -euo pipefail
echo "version=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build & push via Makefile
env:
REGISTRY: ${{ secrets.REGISTRY }}
VERSION: ${{ steps.meta.outputs.version }}
PLATFORM: linux/amd64
EXTRA_TAGS: -t ${{ secrets.REGISTRY }}/browser-controller:latest
run: |
make deploy
- name: Summary
env:
REGISTRY: ${{ secrets.REGISTRY }}
VERSION: ${{ steps.meta.outputs.version }}
run: |
echo "Pushed image: ${REGISTRY}/browser-controller:${VERSION}"