forked from teodor-elstad/github-actions-101
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (38 loc) · 1.21 KB
/
hello-deploy.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
name: "Hello Deploy"
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Login to container registry"
uses: docker/login-action@v2
with:
registry: devops101registry.azurecr.io
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Notes.Api/Dockerfile
push: true
tags: devops101registry.azurecr.io/notes-api:v${{ github.run_number }}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- uses: azure/setup-kubectl@v3
- uses: azure/k8s-set-context@v1
with:
method: kubeconfig
kubeconfig: ${{ secrets.KUBERNETES_CLUSTER_CONFIG }}
context: devops-101-cluster
- uses: Azure/k8s-deploy@v3.1
with:
manifests: Notes.Api/Kubernetes.yaml
images: devops101registry.azurecr.io/notes-api:v${{ github.run_number }}