refactor: Update README.md to enhance clarity and modernize content #2
This file contains hidden or 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: Build & Deploy to Azure | |
| on: | |
| push: | |
| branches: [main] | |
| env: | |
| REGISTRY: ${{ secrets.ACR_LOGIN_SERVER }} | |
| IMAGE_NAME: megalearning | |
| RESOURCE_GROUP: rg-megalearning | |
| CONTAINER_APP_NAME: megalearning-app | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Login to Azure Container Registry | |
| uses: azure/docker-login@v2 | |
| with: | |
| login-server: ${{ secrets.ACR_LOGIN_SERVER }} | |
| username: ${{ secrets.ACR_USERNAME }} | |
| password: ${{ secrets.ACR_PASSWORD }} | |
| - name: Build and push Docker image | |
| run: | | |
| docker build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} \ | |
| -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest . | |
| docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | |
| docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
| - name: Login to Azure | |
| uses: azure/login@v2 | |
| with: | |
| creds: ${{ secrets.AZURE_CREDENTIALS }} | |
| - name: Deploy to Azure Container Apps | |
| uses: azure/container-apps-deploy-action@v2 | |
| with: | |
| resourceGroup: ${{ env.RESOURCE_GROUP }} | |
| containerAppName: ${{ env.CONTAINER_APP_NAME }} | |
| imageToDeploy: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} |