RockPaperScissorsLizardSpock/.github/workflows/node_player_cicd.yml

64 строки
2.3 KiB
YAML

# Node Player Workflow.
name: NodePlayer
on:
workflow_dispatch:
push:
paths:
- Source/Services/RPSLS.NodePlayer.Api/**
- .github/workflows/node_player_cicd.yml
- Deploy/helm/node-player/**
branches:
- main
jobs:
buildpush:
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v1
- name: Build the Docker image
working-directory: Source/Services/RPSLS.NodePlayer.Api
run: docker build . --file Dockerfile --tag ${{ secrets.ACR_NAME }}.azurecr.io/node.player:gh-${{ github.sha }}
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Set Azure subscription
run: |
az account set -s ${{ secrets.AZURE_SUBSCRIPTION }}
- name: Docker push
run: |
az acr login -n ${{ secrets.ACR_NAME }}
docker push ${{ secrets.ACR_NAME }}.azurecr.io/node.player:gh-${{ github.sha }}
- name: Set AKS kubectl context
uses: azure/aks-set-context@v1
with:
creds: '${{ secrets.AZURE_CREDENTIALS }}'
cluster-name: ${{ secrets.CLUSTER_NAME }}
resource-group: ${{ secrets.RESOURCE_GROUP }}
- name: Init Helm
run: |
az acr helm repo add -n ${{ secrets.ACR_NAME }}
- name: Package Helm chart
run: |
helm package Deploy/helm/node-player -d Deploy/helm/__charts --version 1.0.0-${{ github.sha }}
- name: Upload chart to ACR
run: |
az acr helm push Deploy/helm/__charts/node-player-1.0.0-${{ github.sha }}.tgz -n ${{ secrets.ACR_NAME }}
- name: Generate config file
shell: pwsh
run: |
az extension add --name application-insights
Deploy/powershell/Generate-Config.ps1 -gvaluesTemplate gvalues.template.gh -resourceGroup ${{ secrets.RESOURCE_GROUP }} -outputFile _values-gh.yaml -aksHost ${{ secrets.AKS_HOST }} -resourceGroupAcr ${{ secrets.RESOURCE_GROUP_ACR }}
- name: Install Helm Chart
run: |
helm repo update
helm upgrade --install -f Deploy/powershell/_values-gh.yaml --set image.repository=${{ secrets.ACR_NAME }}.azurecr.io/node.player --set image.tag=gh-${{ github.sha }} --set replicaCount=2 node-player ${{ secrets.ACR_NAME }}/node-player --version=1.0.0-${{ github.sha }}