add CI to build image and push to ghcr

Signed-off-by: David van der Spek <vanderspek.david@gmail.com>
This commit is contained in:
David van der Spek 2023-03-06 14:53:44 +01:00
parent 249ae4c575
commit f2d2c22657
2 changed files with 52 additions and 1 deletions

51
.github/workflows/ci.yaml vendored Normal file
View file

@ -0,0 +1,51 @@
name: CI / cert-manager webhook
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
publish:
name: Test build and push cert-manager-webhook container
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
packages: 'write'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/pluralsh/plural-certmanager-webhook
# generate Docker tags based on the following events/attributes
tags: |
type=sha
type=ref,event=pr
type=ref,event=branch
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: "."
file: "./Dockerfile"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64

View file

@ -21,9 +21,9 @@ jobs:
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/pluralsh/plural-certmanager-webhook
dkr.plural.sh/bootstrap/plural-certmanager-webhook
gcr.io/pluralsh/plural-certmanager-webhook
ghcr.io/pluralsh/plural-certmanager-webhook
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}