Skip to content

Update README.md

Update README.md #14

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: CICD
on:
push:
branches: [ "main" ]
jobs:
generate-version:
runs-on: ubuntu-latest
permissions: # to publish the new tag to github
contents: write
steps:
- uses: actions/checkout@v4
- name: Github Tag Bump
id: tag_bump
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INITIAL_VERSION: 1.0.2 # this comes from your Contracts pkg
DEFAULT_BUMP: patch # 1.0.x
outputs:
new_version: ${{ steps.tag_bump.outputs.new_tag }} # store the generated tag
# build docker image
build-and-deploy-service:
runs-on: ubuntu-latest
needs: generate-version
env:
APP_NAME: play-economy-microservices
ACR_NAME: playeconomyacr
AZ_RG_NAME: playeconomy
SERVICE_NAME: trading
HELM_CHART_VERSION: 0.1.2
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4 # checkout the latest code
- name: Azure Login
uses: Azure/[email protected]
with:
client-id: ${{secrets.AZURE_CLIENT_ID}}
tenant-id: ${{secrets.AZURE_TENANT_ID}}
subscription-id: ${{secrets.AZURE_SUBSCRIPTION_ID}}
- name: Login to container registry
run: az acr login --name ${{ env.ACR_NAME }}
- name: Build and push Docker images
uses: docker/[email protected]
with:
# List of secrets to expose to the build (e.g., key=string, GIT_AUTH_TOKEN=mytoken)
secrets: |
"GH_OWNER=${{github.repository_owner}}"
"GH_PAT=${{secrets.GH_PAT}}"
tags: ${{env.ACR_NAME}}.azurecr.io/play.trading:${{ needs.generate-version.outputs.new_version }}
push: true
- name: Get AKS Credentials
run: az aks get-credentials --resource-group ${{ env.AZ_RG_NAME }} --name ${{ env.AZ_RG_NAME }}
# Install Helm to use it
- name: Helm tool installer
uses: Azure/setup-helm@v3
with:
token: ${{ secrets.GITHUB_TOKEN }} # GitHub token. Required only if 'version' == 'latest'
- name: Login to Helm registry
run: |
helmUser="00000000-0000-0000-0000-000000000000"
helmPassword=$(az acr login --name ${{ env.ACR_NAME }} --expose-token --output tsv --query accessToken)
helm registry login ${{ env.ACR_NAME }}.azurecr.io --username $helmUser --password $helmPassword
- name: Deploy Helm Chart
run: |
helm upgrade \
${{env.SERVICE_NAME}}-service \
oci://${{ env.ACR_NAME }}.azurecr.io/helm/microservice \
--version ${{env.HELM_CHART_VERSION}} \
-f helm/values.yaml \
-n ${{env.SERVICE_NAME}} \
--set image.tag=${{ needs.generate-version.outputs.new_version }} \
--install \
--wait