generated from CodeChefVIT/template
-
Notifications
You must be signed in to change notification settings - Fork 5
51 lines (39 loc) · 1.49 KB
/
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
name: Publish Docker Image to Docker Hub
on:
push:
branches:
- master # Change this to the branch you want to trigger on
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: "Create env file"
run: |
echo "${{ secrets.ENV_FILE }}" > .env
cat .env
- name: Build and push Docker image
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
docker buildx create --use
docker buildx build --push -t $DOCKER_USERNAME/cookoff:latest .
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Save DigitalOcean kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 cookoff-cluster
- name: Deploy to DigitalOcean Kubernetes
run: kubectl apply -f deployment.yaml
- name: Rollout DigitalOcean Kubernetes
run: kubectl rollout restart deployment cookooff-backend-deployment
- name: Pod Status
run: kubectl get pods
- name: Verify deployment
run: kubectl rollout status deployment/cookooff-backend-deployment