|
1 | | -name : Build and Deploy |
| 1 | +name : Build and Deploy to Dev |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [development,main] |
| 5 | + branches: [development] |
6 | 6 |
|
7 | 7 | env: |
8 | 8 | PROJECT_ID: ${{ secrets.GKE_PROJECT }} |
9 | 9 | GKE_CLUSTER_DEV: nmrxiv-dev |
10 | | - GKE_CLUSTER_PROD: nmrxiv-prod |
11 | 10 | GKE_ZONE: europe-west3-a |
12 | 11 | DEPLOYMENT_NAME: nmrxiv-nmrium |
13 | 12 | REPOSITORY_NAME_DEV: nmrxiv-dev |
14 | | - REPOSITORY_NAME_PROD: nmrxiv-prod |
15 | 13 | IMAGE: nmrium |
16 | 14 |
|
17 | 15 | jobs: |
|
71 | 69 | kubectl rollout restart deployment/$DEPLOYMENT_NAME |
72 | 70 | kubectl rollout status deployment/$DEPLOYMENT_NAME --timeout=300s |
73 | 71 | kubectl get services -o wide |
74 | | -
|
75 | | - setup-build-publish-deploy-prod: |
76 | | - name: deploy to prod |
77 | | - if: github.ref == 'refs/heads/main' |
78 | | - runs-on: ubuntu-latest |
79 | | - needs: lint |
80 | | - steps: |
81 | | - - name: Checkout |
82 | | - uses: actions/checkout@v2 |
83 | | - |
84 | | - # Setup gcloud CLI |
85 | | - - uses: google-github-actions/setup-gcloud@94337306dda8180d967a56932ceb4ddcf01edae7 |
86 | | - with: |
87 | | - service_account_key: ${{ secrets.GKE_SA_KEY }} |
88 | | - project_id: ${{ secrets.GKE_PROJECT }} |
89 | | - |
90 | | - # Configure docker to use the gcloud command-line tool as a credential helper |
91 | | - - run: |- |
92 | | - gcloud auth configure-docker europe-west3-docker.pkg.dev |
93 | | - # Get the GKE credentials so we can deploy to the cluster |
94 | | - - uses: google-github-actions/get-gke-credentials@v0.3.0 |
95 | | - with: |
96 | | - cluster_name: ${{ env.GKE_CLUSTER_PROD }} |
97 | | - location: ${{ env.GKE_ZONE }} |
98 | | - credentials: ${{ secrets.GKE_SA_KEY }} |
99 | | - |
100 | | - # Build the Docker image |
101 | | - - name: Build Image |
102 | | - run: |- |
103 | | - docker build -f Dockerfile.prod --tag europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME_PROD/$IMAGE:latest . |
104 | | - # Push the Docker image to Google Artifact Registry |
105 | | - - name: Publish Image to Google Artifact Registry |
106 | | - run: |- |
107 | | - docker push "europe-west3-docker.pkg.dev/$PROJECT_ID/$REPOSITORY_NAME_PROD/$IMAGE:latest" |
108 | | -
|
109 | | - # Deploy the latest Docker image to the GKE cluster |
110 | | - - name: Deploy |
111 | | - run: |- |
112 | | - kubectl rollout restart deployment/$DEPLOYMENT_NAME |
113 | | - kubectl rollout status deployment/$DEPLOYMENT_NAME --timeout=300s |
114 | | - kubectl get services -o wide |
0 commit comments