Skip to content

Commit

Permalink
Adding workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
ascheibal committed Dec 20, 2021
1 parent afeeed6 commit 146f6ec
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/deploytoAksCluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
on: [push]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- uses: azure/docker-login@v1
with:
login-server: ddccsrv.azurecr.io
username: ${{ secrets.acr_ddccsrv_username }}
password: ${{ secrets.acr_ddccsrv_password }}

- name: Build and push image to ACR
id: build-image
run: |
docker build "$GITHUB_WORKSPACE/" -f "Dockerfile" -t ddccsrv.azurecr.io/ddccservices:${{ github.sha }} --label dockerfile-path=Dockerfile
docker push ddccsrv.azurecr.io/ddccservices:${{ github.sha }}
- uses: azure/k8s-set-context@v1
with:
kubeconfig: ${{ secrets.aks_ddccservices_kubeConfig }}
id: login

- name: Create namespace
run: |
namespacePresent=`kubectl get namespace | grep default | wc -l`
if [ $namespacePresent -eq 0 ]
then
echo `kubectl create namespace default`
fi
- uses: azure/k8s-create-secret@v1
with:
namespace: default
container-registry-url: ddccsrv.azurecr.io
container-registry-username: ${{ secrets.acr_ddccsrv_username }}
container-registry-password: ${{ secrets.acr_ddccsrv_password }}
secret-name: ddccservicesdockerauth

- uses: azure/k8s-deploy@v1.2
with:
namespace: default
manifests: |
manifests/deployment.yml
manifests/service.yml
images: |
ddccsrv.azurecr.io/ddccservices:${{ github.sha }}
imagepullsecrets: |
ddccservicesdockerauth

0 comments on commit 146f6ec

Please sign in to comment.