Skip to content

Commit

Permalink
fx: workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
shivanshs9 committed Nov 10, 2024
1 parent d73f88b commit 495d9ef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,22 @@ on:
repo:
description: "Repository name"
required: true
type: string
registry:
description: "Google Artifact registry"
required: false
default: "docker.pkg.dev"
type: string
dockerfile:
description: "Dockerfile path"
required: false
default: "Dockerfile"
type: string
context:
description: "Docker context"
required: false
default: "."
project_id:
description: "Google project ID"
required: true
google_key:
description: "Google service account key in BASE64"
required: true
type: string
outputs:
imageid:
description: "Image ID"
Expand All @@ -36,13 +34,10 @@ jobs:
name: "Build & Push"
runs-on: ubuntu-latest
outputs:
imageid:
description: "Image ID"
value: ${{ steps.build.outputs.imageid }}
tag:
description: "Image tag"
value: ${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}
imageid: ${{ steps.build.outputs.imageid }}
tag: ${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}
steps:
- uses: actions/checkout@v4
- name: Docker login to Google Cloud
id: vars
run: |
Expand All @@ -52,15 +47,15 @@ jobs:
echo "branch=$(echo "$branch" | tr '/\' '-')" >> $GITHUB_OUTPUT
shell: bash
env:
B64_GOOGLE_KEY: ${{ inputs.google_key }}
B64_GOOGLE_KEY: ${{ secrets.GCLOUD_SECRET_KEY }}
REGISTRY: ${{ inputs.registry }}
# - name: Check image
# id: image_exists
# continue-on-error: true
# uses: cloudposse/github-action-docker-image-exists@main
# with:
# registry: ${{ inputs.registry }}
# image_name: ${{ inputs.project_id }}/${{ inputs.repo }}
# image_name: ${{ secrets.GCLOUD_PROJECT }}/${{ inputs.repo }}
# tag: ${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}
- uses: docker/setup-buildx-action@v3
if: steps.image_exists.outcome == 'failure'
Expand All @@ -76,4 +71,4 @@ jobs:
labels: |
ci.run_id=${{ github.run_id }}
tags: |
${{ inputs.registry }}/${{ inputs.project_id }}/${{ inputs.repo }}:${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}
${{ inputs.registry }}/${{ secrets.GCLOUD_PROJECT }}/${{ inputs.repo }}:${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}
40 changes: 12 additions & 28 deletions .github/workflows/cd-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,17 @@ on:
jobs:
push-backend:
name: Build backend
runs-on: ubuntu-latest
outputs:
version: ${{ steps.build.outputs.tag }}
steps:
- uses: actions/checkout@v4
- uses: ./actions/build-push-gcloud
id: build
with:
google_key: ${{ secrets.GCLOUD_SECRET_KEY }}
repo: services/whisper-notes-backend
dockerfile: backend.Dockerfile
registry: europe-north1-docker.pkg.dev
project_id: ${{ secrets.GCLOUD_PROJECT }}
secrets: inherit
uses: ./.github/workflows/build-push-gcloud.yaml
with:
repo: services/whisper-notes-backend
dockerfile: backend.Dockerfile
registry: europe-north1-docker.pkg.dev
secrets: inherit
push-frontend:
name: Build frontend
runs-on: ubuntu-latest
outputs:
version: ${{ steps.build.outputs.tag }}
steps:
- uses: actions/checkout@v4
- uses: ./actions/build-push-gcloud
id: build
with:
google_key: ${{ secrets.GCLOUD_SECRET_KEY }}
repo: services/whisper-notes-frontend
dockerfile: frontend.Dockerfile
registry: europe-north1-docker.pkg.dev
project_id: ${{ secrets.GCLOUD_PROJECT }}
secrets: inherit
uses: ./.github/workflows/build-push-gcloud.yaml
with:
repo: services/whisper-notes-frontend
dockerfile: frontend.Dockerfile
registry: europe-north1-docker.pkg.dev
secrets: inherit

0 comments on commit 495d9ef

Please sign in to comment.