add github CI

Signed-off-by: DavidSpek <vanderspek.david@gmail.com>
This commit is contained in:
DavidSpek 2022-07-29 15:52:44 +02:00
parent 0ced76aa33
commit 888b83b1f5

63
.github/workflows/publish.yaml vendored Normal file
View file

@ -0,0 +1,63 @@
name: CD / cert-manager webhook
on:
push:
tags:
- 'v*.*.*'
jobs:
publish:
name: Build and push Console container
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
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: |
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}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- uses: google-github-actions/auth@v0
with:
workload_identity_provider: 'projects/${{ secrets.GOOGLE_PROJECT_ID }}/locations/global/workloadIdentityPools/github/providers/github'
service_account: 'terraform@pluralsh.iam.gserviceaccount.com'
token_format: 'access_token'
create_credentials_file: true
- uses: google-github-actions/setup-gcloud@v0.3.0
- name: Login to gcr
run: gcloud auth configure-docker -q
- name: Login to plural registry
uses: docker/login-action@v1
with:
registry: dkr.plural.sh
username: mjg@plural.sh
password: ${{ secrets.PLURAL_ACCESS_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: "."
file: "./Dockerfile"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}