Skip to content

Commit

Permalink
initialize build & deploy pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-bcw committed Mar 27, 2024
1 parent 64c4851 commit 97a94c1
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build & Deploy

on:
push:
branches:
- main

env:
DEFAULT_TAGS: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
jobs:
build:
name: Build docker images
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Get docker image meta (leader)
id: leader-meta
uses: docker/metadata-action@v5
with:
images: gcr/zero-bin-leader
tags: ${{ env.DEFAULT_TAGS }}

- name: Get docker image meta (worker)
id: worker-meta
uses: docker/metadata-action@v5
with:
images: gcr/zero-bin-worker
tags: ${{ env.DEFAULT_TAGS }}

- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v1
with:
token_format: access_token
workload_identity_provider: <workload_identity_provider>
service_account: <service_account>

- name: Login to GCR
uses: docker/login-action@v3
with:
registry: gcr.io
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}

- name: Build and push leader
uses: docker/build-push-action@v5
with:
context: .
dockerfile: leader.Dockerfile
push: true
tags: ${{ steps.leader-meta.outputs.tags }}
labels: ${{ steps.leader-meta.outputs.labels }}

- name: Build and push worker
uses: docker/build-push-action@v5
with:
context: .
dockerfile: worker.Dockerfile
push: true
tags: ${{ steps.worker-meta.outputs.tags }}
labels: ${{ steps.worker-meta.outputs.labels }}

0 comments on commit 97a94c1

Please sign in to comment.