Skip to content

Update README.md

Update README.md #24

Workflow file for this run

# This worklflow will perform following actions when the code is pushed to development branch:
# - Run test using Playwright
# - Build the latest docker image in development which needs test to pass first.
# - Push the latest docker image to Google Artifact Registry-Dev.
# - Rollout the latest image in GKE.
#
# Maintainers:
# - name: Nisha Sharma
# - email: [email protected]
name: Build and Deploy to Dev
on:
push:
branches: [development]
env:
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER_DEV: nmrxiv-dev
GKE_ZONE: europe-west3-a
DEPLOYMENT_NAME: nodejs-nmrxiv-nodejs-microservice
DOCKER_HUB_USERNAME : ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD : ${{ secrets.DOCKER_HUB_PASSWORD }}
REPOSITORY_NAME: nodejs-microservice
REPOSITORY_NAMESPACE: nfdi4chem
jobs:
e2etest:
uses: NFDI4Chem/nmrxiv-nodejs-microservice/.github/workflows/e2e.yml@development
setup-build-publish-deploy-dev:
name: Deploy to dev
if: github.ref == 'refs/heads/development'
runs-on: ubuntu-latest
needs: e2etest
steps:
- name: Checkout
uses: actions/checkout@v2
# Setup gcloud CLI
- name: Setup CLI
uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
# Configure docker to use the gcloud command-line tool as a credential helper
- name: Configure docker
run: |-
gcloud auth configure-docker europe-west3-docker.pkg.dev
# Get the GKE credentials
- name: Get GKE credentials
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ env.GKE_CLUSTER_DEV }}
location: ${{ env.GKE_ZONE }}
credentials: ${{ secrets.GKE_SA_KEY }}
# Login to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_PASSWORD }}
# Build and push image to Docker Hub
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
build-args: |
RELEASE_VERSION=dev-latest
tags: ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:dev-latest
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_PASSWORD }}
# Deploy the latest Docker image to the GKE cluster
- name: Deploy
run: |-
kubectl rollout restart deployment/$DEPLOYMENT_NAME
kubectl rollout status deployment/$DEPLOYMENT_NAME --timeout=300s
kubectl get services -o wide