From f2d2c22657104f87bf69e8ca60524c8036b5f199 Mon Sep 17 00:00:00 2001 From: David van der Spek Date: Mon, 6 Mar 2023 14:53:44 +0100 Subject: [PATCH] add CI to build image and push to ghcr Signed-off-by: David van der Spek --- .github/workflows/ci.yaml | 51 ++++++++++++++++++++++++++++++++++ .github/workflows/publish.yaml | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..a0b01d9 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index b4fa223..16e6afd 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -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}}