|
| 1 | +# Game Manager Workflow, debug,,, |
| 2 | + |
| 3 | +name: Game Manager |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + paths: |
| 8 | + - Source/Services/RPSLS.Game.Api/** |
| 9 | + - .github/workflows/game-manager_cicd.yml |
| 10 | + - Deploy/helm/game-api/** |
| 11 | + branches: |
| 12 | + - master |
| 13 | + |
| 14 | +jobs: |
| 15 | + buildpush: |
| 16 | + runs-on: ubuntu-16.04 |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v1 |
| 19 | + - name: Build the Docker image |
| 20 | + working-directory: Source/Services/RPSLS.Game.Api |
| 21 | + run: docker build . --file Dockerfile --tag ${{ secrets.ACR_NAME }}.azurecr.io/game.api:gh-${{ github.sha }} |
| 22 | + - name: Login to Azure |
| 23 | + uses: azure/login@v1 |
| 24 | + with: |
| 25 | + creds: ${{ secrets.AZURE_CREDENTIALS }} |
| 26 | + - name: Set Azure subscription |
| 27 | + run: | |
| 28 | + az account set -s ${{ secrets.AZURE_SUBSCRIPTION }} |
| 29 | + - name: Docker push |
| 30 | + run: | |
| 31 | + az acr login -n ${{ secrets.ACR_NAME }} |
| 32 | + docker push ${{ secrets.ACR_NAME }}.azurecr.io/game.api:gh-${{ github.sha }} |
| 33 | + - name: Set AKS kubectl context |
| 34 | + uses: azure/aks-set-context@v1 |
| 35 | + with: |
| 36 | + creds: '${{ secrets.AZURE_CREDENTIALS }}' |
| 37 | + cluster-name: ${{ secrets.CLUSTER_NAME }} |
| 38 | + resource-group: ${{ secrets.RESOURCE_GROUP }} |
| 39 | + - name: Set up Helm |
| 40 | + uses: azure/setup-helm@v1 |
| 41 | + with: |
| 42 | + version: latest |
| 43 | + id: install |
| 44 | + - name: Helm repo add |
| 45 | + run: | |
| 46 | + #curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 > get_helm.sh |
| 47 | + #chmod 700 get_helm.sh |
| 48 | + #./get_helm.sh |
| 49 | + az acr helm repo add -n ${{ secrets.ACR_NAME }} |
| 50 | + - name: Package Helm chart |
| 51 | + run: | |
| 52 | + helm package Deploy/helm/game-api -d Deploy/helm/__charts --version 1.0.0-${{ github.sha }} |
| 53 | + - name: Upload chart to ACR |
| 54 | + run: | |
| 55 | + az acr helm push Deploy/helm/__charts/game-api-1.0.0-${{ github.sha }}.tgz -n ${{ secrets.ACR_NAME }} |
| 56 | + - name: Generate config file |
| 57 | + shell: pwsh |
| 58 | + run: | |
| 59 | + az extension add --name application-insights |
| 60 | + Deploy/powershell/Generate-Config.ps1 -gvaluesTemplate gvalues.template.gh -resourceGroup ${{ secrets.RESOURCE_GROUP }} -outputFile _values-gh.yaml -sslSupport custom -aksHost ${{ secrets.AKS_HOST }} -resourceGroupAcr ${{ secrets.RESOURCE_GROUP_ACR }} -kvClientId ${{ secrets.KV_CLIENT_ID }} |
| 61 | + - name: Install Helm Chart |
| 62 | + run: | |
| 63 | + helm repo update |
| 64 | + helm upgrade --install -f Deploy/powershell/_values-gh.yaml --set kv.clientsecret=${{ secrets.KV_CLIENT_SECRET }} --set kv.enabled=true --set image.repository=${{ secrets.ACR_NAME }}.azurecr.io/game.api --set image.tag=gh-${{ github.sha }} --set replicaCount=2 game-api ${{ secrets.ACR_NAME }}/game-api --version=1.0.0-${{ github.sha }} |
| 65 | + |
| 66 | + |
0 commit comments