forked from swaggerql/swagger-combine-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (59 loc) · 2.73 KB
/
build.yml
File metadata and controls
60 lines (59 loc) · 2.73 KB
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
name: mumbai-api-docs-deployment
on:
push:
branches: [ master ]
env:
IMAGE_NAME: gcr.io/${{ secrets.GCP_MUMBAI_PROJECT_ID }}/api-docs
SHA: $(echo ${GITHUB_SHA} | cut -c1-8)
jobs:
docker-deployment:
name: Push to Google Container Registry
runs-on: ubuntu-latest
steps:
- name: Get SHA
shell: bash
run: echo "SHA=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
- name: Login
uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_MUMBAI_PROJECT_ID }}
service_account_email: ${{ secrets.GCP_MUMBAI_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_MUMBAI_SA_CREDENTIALS }}
- name: Configure Docker
run: gcloud auth configure-docker --quiet
- name: Checkout repository
uses: actions/checkout@v2
- name: Build Docker image
run: docker build -t ${{ env.IMAGE_NAME}}:${{ env.SHA }} --build-arg NPM_TOKEN=${{ secrets.NPM_TOKEN }} .
- name: Push Docker image
run: docker push ${{ env.IMAGE_NAME}}:${{ env.SHA }}
kubernetes-deployment:
runs-on: ubuntu-latest
steps:
- name: Get SHA
shell: bash
run: echo "SHA=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Kustomize
run: |-
cd gke/
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
chmod u+x ./kustomize
- name: Login
uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_MUMBAI_PROJECT_ID }}
service_account_email: ${{ secrets.GCP_MUMBAI_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_MUMBAI_SA_CREDENTIALS }}
- name: Configure Kubernetes
run: gcloud container clusters get-credentials ${{ secrets.GCP_MUMBAI_PROJECT_ID }}-cluster --region europe-west2
- name: Deploy
run: |-
cd gke/
./kustomize edit set image gcr.io/PROJECT_ID/IMAGE:TAG=${{ env.IMAGE_NAME}}:${{ env.SHA }}
./kustomize edit set namespace ${{ secrets.GCP_MUMBAI_PROJECT_ID }}-api-docs
./kustomize build . | kubectl apply -f -
kubectl rollout status deployment/api-docs-deployment --namespace ${{ secrets.GCP_MUMBAI_PROJECT_ID }}-api-docs
kubectl get services -o wide
needs: docker-deployment