-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
999e54b
commit 5c19d9b
Showing
1 changed file
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,19 +66,62 @@ jobs: | |
|
||
env: | ||
APP_NAME: play-economy-microservices | ||
ACR_NAME: playeconomyacr | ||
AZ_RG_NAME: playeconomy | ||
SERVICE_NAME: catalog | ||
HELM_CHART_VERSION: 0.1.0 | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
packages: write | ||
|
||
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.APP_NAME}}.azurecr.io/play.catalog:${{ needs.generate-version.outputs.new_version }} | ||
tags: ${{env.ACR_NAME}}.azurecr.io/play.catalog:${{ 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 | ||