ci: add conventional commit tooling #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main-workflow | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Set up Kind | |
run: | | |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.26.0/kind-linux-arm64 | |
chmod +x ./kind | |
sudo mv ./kind /usr/local/bin/kind | |
- name: Install Chainsaw | |
uses: kyverno/action-install-chainsaw@v0.1.0 | |
with: | |
release: v0.2.12 | |
- name: Install dependencies | |
run: make deps docker-deps | |
- name: Build (Go) | |
run: make build-controller | |
- name: Test (Go) | |
run: make test | |
- name: Build (Docker) | |
run: make docker-build | |
# - name: Test (Chainsaw) | |
# run: make kind-setup chainsaw-test | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/#-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata for Docker | |
id: meta | |
if: github.event_name != 'pull_request' | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository }}/controller | |
tags: | | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
type=sha,format=short | |
- name: Build and push Docker image | |
if: github.event_name != 'pull_request' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: build/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |