Merge pull request #8 from LakinduOshadha/main #12
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
name: mylocal | |
"on": | |
push: | |
branches: | |
- main | |
workflow_dispatch: {} | |
env: | |
ACR_RESOURCE_GROUP: acrworkflow1678760444265 | |
AZURE_CONTAINER_REGISTRY: mylocalreg | |
CLUSTER_NAME: gig-aks | |
CLUSTER_RESOURCE_GROUP: GIG | |
CONTAINER_NAME: mylocal | |
DEPLOYMENT_MANIFEST_PATH: | | |
./deployment/mylocal-deployment.yml | |
./deployment/mylocal-ingress.yml | |
./deployment/mylocal-service.yml | |
jobs: | |
buildImage: | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: azure/[email protected] | |
name: Azure login | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
- name: Build and push image to ACR | |
run: az acr build --image ${{ env.CONTAINER_NAME }}:${{ github.sha }} --registry ${{ env.AZURE_CONTAINER_REGISTRY }} -g ${{ env.ACR_RESOURCE_GROUP }} -f ./Dockerfile --build-arg SERVER_HOST=${{secrets.SERVER_URL}} --build-arg GIG_SERVER=${{secrets.GIG_SERVER}} --build-arg GEO_SERVER=${{secrets.GEO_SERVER}} ./ | |
deploy: | |
permissions: | |
actions: read | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
needs: | |
- buildImage | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: azure/[email protected] | |
name: Azure login | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
- uses: azure/use-kubelogin@v1 | |
name: Set up kubelogin for non-interactive login | |
with: | |
kubelogin-version: v0.0.25 | |
- uses: azure/aks-set-context@v3 | |
name: Get K8s context | |
with: | |
admin: "false" | |
cluster-name: ${{ env.CLUSTER_NAME }} | |
resource-group: ${{ env.CLUSTER_RESOURCE_GROUP }} | |
use-kubelogin: "true" | |
- uses: Azure/k8s-deploy@v4 | |
name: Deploys application | |
with: | |
action: deploy | |
images: ${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }} | |
manifests: ${{ env.DEPLOYMENT_MANIFEST_PATH }} | |
namespace: applications |