forked from gabrielecirulli/2048
-
Notifications
You must be signed in to change notification settings - Fork 9
59 lines (50 loc) · 1.37 KB
/
k8s.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
name: Deploy to Kubernetes Cluster
# Triggers on new tag pushes
on:
push:
tags:
- v*
jobs:
# Builds a new container image based on the tag release
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout files
uses: actions/checkout@v2
# Pushes the image to GitHub Container Registry
- uses: mr-smithers-excellent/docker-build-push@v4
name: Build & push Docker image
with:
image: mvkaran/2048
registry: ghcr.io
dockerfile: Dockerfile
username: ${{ github.actor }}
password: ${{ secrets.PAT }}
deploy:
name: Deploy
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set context from Kubeconfig
uses: azure/k8s-set-context@v1
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBECONFIG }}
context: github-demo
id: setcontext
- name: Get tag name
uses: olegtarasov/get-tag@v2
- name: Get new container image tag
id: image-tag
run: |
echo "::set-output name=image::ghcr.io/mvkaran/2048:$GIT_TAG_NAME"
- name: Deploy to Kubernetes
uses: Azure/k8s-deploy@v1
with:
manifests: |
2048.yaml
images: |
${{ steps.image-tag.outputs.image }}