Skip to content

chore: consumer ci and charts,deployments #11

chore: consumer ci and charts,deployments

chore: consumer ci and charts,deployments #11

Workflow file for this run

name: Build and Push to GHCR
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "**/consumer/**"
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository }}/consumer
tags: |
type=sha,prefix=commit,length=7
type=raw,value=latest,enable=true
- name: Build and push to GHCR
uses: docker/build-push-action@v2
with:
context: packages/consumer
push: true
tags: ${{ steps.meta.outputs.tags }}
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: production
steps:
- name: Check Out Repo
uses: actions/checkout@v4
- name: Set up Cloud SDK
uses: google-github-actions/[email protected]
with:
service_account_key: '${{ secrets.GCP_CREDENTIALS }}'
project_id: '${{ secrets.GCP_PROJECT_ID }}'
- name: Get kubernetes config
env:
USE_GKE_GCLOUD_AUTH_PLUGIN: "true"
run: |
gcloud components install gke-gcloud-auth-plugin
gcloud container clusters get-credentials ${{ secrets.GCP_CLUSTER_NAME }} --zone=${{ secrets.GCP_ZONE }}
- name: Get tag name
id: tag
run: echo "::set-output name=sha::${GITHUB_SHA::7}"
- name: Apply Helmfile
uses: hiberbee/github-action-helm@latest
env:
IMAGE_TAG: '${{ steps.tag.outputs.sha }}'
DOCKER_USERNAME: '${{ github.repository_owner }}'
DOCKER_PASSWORD: '${{ secrets.GITHUB_TOKEN }}'
INTERBROKER_PASSWORD: '{{ secrets.INTERBROKER_PASSWORD }}'
CONTROLLER_PASSWORD: '{{ secrets.CONTROLLER_PASSWORD }}'
KRAFT_CLUSTER_ID: '{{ secrets.KRAFT_CLUSTER_ID }}'
with:
helmfile: diff
helmfile-config: packages/cloud/helmfile.yaml