Skip to content

First Draft of TTS moth SP movemeny is in working order and tested. #65

First Draft of TTS moth SP movemeny is in working order and tested.

First Draft of TTS moth SP movemeny is in working order and tested. #65

on: [push]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Create ACR
id: create-acr
run: |
az acr create -n ZSpreadAPIContainer -g ZSpreadAPIContainerb65b-rg --location "East US" --sku Standard --admin-enabled
echo "::set-output name=acr_username::`az acr credential show -n ZSpreadAPIContainer --query username | xargs`"
echo "::set-output name=acr_password::`az acr credential show -n ZSpreadAPIContainer --query passwords[0].value | xargs`"
echo "::add-mask::`az acr credential show -n ZSpreadAPIContainer --query passwords[0].value | xargs`"
- uses: azure/docker-login@v1
with:
login-server: zspreadapicontainer.azurecr.io
username: ${{ steps.create-acr.outputs.acr_username }}
password: ${{ steps.create-acr.outputs.acr_password }}
- name: Build and push image to ACR
id: build-image
run: |
docker build "$GITHUB_WORKSPACE/src/KubernetesService" -f "src/KubernetesService/Dockerfile" -t zspreadapicontainer.azurecr.io/zspreadapicluster:${{ github.sha }}
docker push zspreadapicontainer.azurecr.io/zspreadapicluster:${{ github.sha }}
- uses: azure/k8s-set-context@v1
id: login
with:
kubeconfig: ${{ secrets.aks_zspreadapicluster_kubeConfig }}
- name: Create namespace
run: |
namespacePresent=`kubectl get namespace | grep zspreadapiclusterd86b | wc -l`
if [ $namespacePresent -eq 0 ]
then
echo `kubectl create namespace zspreadapiclusterd86b`
fi
- uses: azure/k8s-create-secret@v1
with:
namespace: zspreadapiclusterd86b
container-registry-url: zspreadapicontainer.azurecr.io
container-registry-username: ${{ steps.create-acr.outputs.acr_username }}
container-registry-password: ${{ steps.create-acr.outputs.acr_password }}
secret-name: zspreadapicldockerauth
- uses: azure/k8s-deploy@v1
with:
namespace: zspreadapiclusterd86b
manifests: |
manifests/deployment.yml
manifests/service.yml
images: |
zspreadapicontainer.azurecr.io/zspreadapicluster:${{ github.sha }}
imagepullsecrets: |
zspreadapicldockerauth