forked from swaminathanvetri/githubactions-aks-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (72 loc) · 3.64 KB
/
deploytoAKS.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# This is a basic workflow to help you get started with Actions
name: AKS Deployment
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup .NET Core SDK
uses: actions/[email protected]
with:
# SDK version to use. Examples: 2.2.104, 3.1, 3.1.x
dotnet-version: 3.1.x
# Optional package source for which to set up authentication. Will consult any existing NuGet.config in the root of the repo and provide a temporary NuGet.config using the NUGET_AUTH_TOKEN environment variable as a ClearTextPassword
- name: dotnet build
run: dotnet build -c release
- name: docker build
run: docker build -t githubactions-aks-demo:'${{github.sha}}' .
- name: docker login
run: docker login --username '${{secrets.DOCKER_LOGIN}}' --password '${{secrets.DOCKER_PASSWORD}}'
- name: tag docker image
run: docker tag githubactions-aks-demo:'${{github.sha}}' '${{secrets.DOCKER_LOGIN}}'/githubactions-aks-demo:'${{github.sha}}'
- name: push docker image
run: docker push '${{secrets.DOCKER_LOGIN}}'/githubactions-aks-demo:'${{github.sha}}'
# - name: Azure Kubernetes set context
# uses: Azure/aks-set-context@v1
# with:
# # Azure credentials i.e. output of `az ad sp create-for-rbac --sdk-auth`
# creds: '${{secrets.AZURE_CREDENTIALS}}'
# # Resource Group Name
# resource-group: aks-demo-rg
# # AKS Cluster Name
# cluster-name: ga-aks-demo-cluster
# # Create K8s secrets to pull images
# - name: Create secret in Kubernetes cluster
# uses: Azure/[email protected]
# with:
# # Container registry url
# container-registry-url: https://index.docker.io/v1/
# # Container registry username
# container-registry-username: '${{secrets.DOCKER_LOGIN}}'
# # Container registry password
# container-registry-password: '${{secrets.DOCKER_PASSWORD}}'
# # Type of Kubernetes secret. For example, docker-registry or generic
# secret-type: docker-registry
# # Name of the secret. You can use this secret name in the Kubernetes YAML configuration file.
# secret-name: docker-image-pull-secret
# # Deploy to k8s cluster
# - name: Deploy to Kubernetes cluster
# uses: Azure/k8s-deploy@v1
# with:
# # Path to the manifest files which will be used for deployment.
# manifests: |
# k8s/deployment.yml
# k8s/service.yml
# # Fully qualified resource URL of the image(s) to be used for substitutions on the manifest files Example: contosodemo.azurecr.io/helloworld:test
# images: '${{secrets.DOCKER_LOGIN}}/githubactions-aks-demo:${{github.sha}}'
# # Name of a docker-registry secret that has already been set up within the cluster. Each of these secret names are added under imagePullSecrets field for the workloads found in the input manifest files
# imagepullsecrets: docker-image-pull-secret
# # deploy/promote/reject
# action: deploy