Skip to content

Merge pull request #227 from NFDI4Chem/chore-whitelisting #122

Merge pull request #227 from NFDI4Chem/chore-whitelisting

Merge pull request #227 from NFDI4Chem/chore-whitelisting #122

Workflow file for this run

# This worklflow will perform following actions when the code is pushed to development branch:
# - Run end to end test.
# - Check Linting.
# - Build the latest docker image in development which needs both e2etest and lint 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: nmrxiv-nmrium
DOCKER_HUB_USERNAME : ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD : ${{ secrets.DOCKER_HUB_PASSWORD }}
REPOSITORY_NAME: nmrium-react-wrapper
REPOSITORY_NAMESPACE: nfdi4chem
jobs:
e2etest:
uses: NFDI4Chem/nmrium-react-wrapper/.github/workflows/e2e.yml@main
lint:
uses: NFDI4Chem/nmrium-react-wrapper/.github/workflows/nodejs.yml@main
setup-build-publish-deploy-dev:
name: Deploy to dev
if: github.ref == 'refs/heads/development'
runs-on: ubuntu-latest
needs: [lint, e2etest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Update version number
run: |
VERSION=${GITHUB_REF//*\/}
echo "export default { version: '$VERSION' };" > src/versionInfo.ts
# 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 }}
# Get the GKE credentials so we can deploy to the cluster
- 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 }}
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.prod
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