Skip to content

Commit

Permalink
Fix: Setup CD pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: George J Padayatti <[email protected]>
  • Loading branch information
georgepadayatti committed Apr 26, 2024
1 parent a88018c commit fd43dee
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release to staging

on:
push:
branches:
- main

# Environment variables available to all jobs and steps in this workflow
env:
GKE_PROJECT: ${{ secrets.GKE_PROJECT_JENKINS }}
GKE_EMAIL: ${{ secrets.GKE_EMAIL_JENKINS }}
GITHUB_SHA: ${{ github.sha }}

jobs:
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@v0
with:
version: "270.0.0"
service_account_email: ${{ secrets.GKE_EMAIL_JENKINS }}
service_account_key: ${{ secrets.GKE_KEY_JENKINS }}

# Setup kubectl
- uses: ThomasKliszowski/setup-kubectl@v1
with:
kube-config: ${{ secrets.KUBE_CONFIG_DATA }}
kube-version: 1.25.4

# Configure docker to use the gcloud command-line tool as a credential helper
- run: |
# Set up docker to authenticate
# via gcloud command-line tool.
gcloud auth configure-docker
# Build, publish and deploy docker image
- name: Build, publish and deploy docker image
shell: 'script -q -e -c "bash {0}"'
run: |
make build publish deploy
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,8 @@ destroy-db-volume: ## Destroy Docker volume and all associated data
publish: $(DEPLOY_VERSION_FILE) ## Publish latest production Docker image to docker hub
docker push $(DEPLOY_VERSION)

deploy: $(DEPLOY_VERSION_FILE) ## Deploy to K8s cluster (e.g. make deploy/{preview,staging,production})
kubectl set image deployment/config-ew config-ew=$(DEPLOY_VERSION) -n eudiwallet
kubectl set image deployment/service-ew service-ew=$(DEPLOY_VERSION) -n eudiwallet

.DEFAULT_GOAL := help

0 comments on commit fd43dee

Please sign in to comment.