-
Notifications
You must be signed in to change notification settings - Fork 3
77 lines (65 loc) · 2.44 KB
/
dev-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# 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
REPOSITORY_NAME_DEV: nmrxiv-dev
IMAGE: nmrium
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@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 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 }}
# Build the Docker image
- name: Build docker image
run: |-
docker build -f Dockerfile.prod --tag europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME_DEV/$IMAGE:latest .
# Push the Docker image to Google Artifact Registry
- name: Publish image to Google Artifact Registry
run: |-
docker push "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME_DEV/$IMAGE:latest"
# 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