-
Notifications
You must be signed in to change notification settings - Fork 12
73 lines (62 loc) · 2.56 KB
/
at_server_dev_deploy.yaml
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
name: at_root deploy (dev)
on:
push:
branches:
- trunk
paths:
- packages/*_root_server/**
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
Docker_Build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# Extract branch for docker tag
- name: Get branch name
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Login to DockerHub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Build the Docker image for Dev
- name: Build and push
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
file: packages/at_root_server/Dockerfile
context: packages/at_root_server
push: true
tags: |
atsigncompany/root:dev_env
atsigncompany/root:dev_env-gha${{ github.run_number }}
atsigncompany/root:dev_env-${{ env.BRANCH }}-gha${{ github.run_number }}
Deploy_On_Dev_K8:
needs: Docker_Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# Extract branch for docker tag
- name: Get branch name
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
# Setup gcloud CLI
- id: 'auth'
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f # v2.1.7
with:
credentials_json: '${{ secrets.GKE_SA_DEV_KEY }}'
- name: 'Set up Cloud SDK'
uses: google-github-actions/setup-gcloud@6189d56e4096ee891640bb02ac264be376592d6a # v2.1.2
# Get the GKE credentials so we can deploy to the cluster
- uses: google-github-actions/get-gke-credentials@206d64b64b0eba0a6e2f25113d044c31776ca8d6 # v2.2.2
with:
cluster_name: ${{ secrets.GKE_DEV_CLUSTER }}
location: ${{ secrets.GKE_DEV_ZONE }}
# Deploy the Docker image to the GKE cluster
- name: Deploy
run: |-
kubectl -n root set image deployment/root root=atsigncompany/root:dev_env-gha${{ github.run_number }}
kubectl rollout restart deployment root -n root