Skip to content

Commit

Permalink
Making deployment upon build
Browse files Browse the repository at this point in the history
  • Loading branch information
kirmorozov committed Apr 1, 2024
1 parent 1ae7533 commit 3474c46
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ jobs:
registry: registry.digitalocean.com
username: ${{ secrets.DIGITALOCEAN_USERNAME }}
password: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

- uses: actions/checkout@v3

- name: Download BlazeFace
Expand All @@ -36,7 +42,21 @@ jobs:
- name: Tag for DO
run: docker image tag thesmile:latest registry.digitalocean.com/thesmile/thesmile:latest

- name: Tag sha for DO
run: docker image tag thesmile:latest registry.digitalocean.com/thesmile/thesmile:$(echo $GITHUB_SHA | head -c7)

- name: Push to DO
run: docker push registry.digitalocean.com/thesmile/thesmile:latest

- name: Push sha to DO
run: docker push registry.digitalocean.com/thesmile/thesmile:$(echo $GITHUB_SHA | head -c7)

- name: Update deployment file
run: TAG=$(echo $GITHUB_SHA | head -c7) && sed -i 's|<IMAGE>|registry.digitalocean.com/thesmile/thesmile:'${TAG}'|' $GITHUB_WORKSPACE/build/k8s/deployment.yml

- name: Save DigitalOcean kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 smile-k8s-1-29-1-do-0-nyc3-1711943773962




34 changes: 34 additions & 0 deletions build/k8s/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: thesmile
name: thesmile

spec:
progressDeadlineSeconds: 600
replicas: 2
revisionHistoryLimit: 10
selector:
matchLabels:
app: thesmile
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: thesmile
spec:
containers:
- image: <IMAGE>
imagePullPolicy: Always
name: thesmile
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30

0 comments on commit 3474c46

Please sign in to comment.