Skip to content

Commit

Permalink
ci: add ci pipelines for pr, push, and tag events
Browse files Browse the repository at this point in the history
Signed-off-by: Zespre Schmidt <starbops@zespre.com>
  • Loading branch information
starbops committed Jul 26, 2024
1 parent 96f873c commit 5c6530c
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Main Build and Publish

on:
push:
branches:
- main

jobs:
build-main:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
starbops/kubebmc-controller
starbops/kbmc
- name: Test
run: make test
- name: Build
run: make build
- name: Docker build and push (controller)
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker build and push (kbmc)
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile.kbmc
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
53 changes: 53 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Pull Request Build

on:
pull_request:
types:
- opened
- synchronize

jobs:
build-pr:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
starbops/kubebmc-controller
starbops/kbmc
- name: Test
run: make test
- name: Build
run: make build
- name: Docker build (controller)
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker build (kbmc)
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile.kbmc
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
57 changes: 57 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Tag Build and Publish

on:
push:
tags:
- "v*"

jobs:
build-tag:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
starbops/kubebmc-controller
starbops/kbmc
- name: Test
run: make test
- name: Build
run: make build
- name: Docker build and push (controller)
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker build and push (kbmc)
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile.kbmc
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 5c6530c

Please sign in to comment.