-
Notifications
You must be signed in to change notification settings - Fork 5
executable file
·63 lines (56 loc) · 1.99 KB
/
gke-dev.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
name: Build and Deploy to GKE Dev
on:
push:
branches:
- cicd
- develop
# Environment variables available to all jobs and steps in this workflow
env:
GITHUB_SHA: ${{ github.sha }}
REGISTRY_HOSTNAME: gcr.io
GKE_PROJECT: df-infrastructure
IMAGE: fortress/api
K8S_ENVIRONMENT: dev
jobs:
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: "auth"
name: "Authenticate to Google Cloud"
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v0"
- name: Setup Docker
run: |
gcloud auth configure-docker gcr.io
# Build & Push the Docker image
- name: Build & Push
run: |
docker build -t $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${GITHUB_SHA} .
docker push $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${GITHUB_SHA}
# Setup kustomize
- name: Setup kustomize
run: |
curl -o kustomize --location https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize_3.1.0_linux_amd64
chmod u+x ./kustomize
mv kustomize /tmp
- name: Checkout dwarvesf/infrastructure
uses: actions/checkout@master
with:
repository: dwarvesf/infrastructure
token: ${{ secrets.GH_PAT }}
path: ./infrastructure
ref: main
- name: Update api version
run: |
cd ./infrastructure/fortress-api/$K8S_ENVIRONMENT
git config user.name lmquang
git config user.email [email protected]
/tmp/kustomize edit set image $REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE=$REGISTRY_HOSTNAME/$GKE_PROJECT/$IMAGE:${GITHUB_SHA}
git commit -am "[skip ci] fortress-api ${K8S_ENVIRONMENT} image update"
git push origin main