fix workflow #134
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: be | |
"on": | |
push: | |
branches: | |
- main | |
workflow_dispatch: {} | |
env: | |
DEPLOYMENT_MANIFEST_PATH: | | |
manifests/deploy-be.yaml | |
manifests/svc-be.yaml | |
jobs: | |
buildImage: | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 | |
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: | | |
export VITE_COGNITO_USER_POOL_ID=${{ secrets.VITE_COGNITO_USER_POOL_ID }} | |
export VITE_COGNITO_CLIENT_ID=${{ secrets.VITE_COGNITO_CLIENT_ID }} | |
az acr build --image be:${{ github.sha }} --registry ${{ secrets.AZURE_CONTAINER_REGISTRY }} -g ${{ secrets.ACR_RESOURCE_GROUP }} -f backend-container/Dockerfile.python backend-container/ | |
az acr build --image be:latest --registry ${{ secrets.AZURE_CONTAINER_REGISTRY }} -g ${{ secrets.ACR_RESOURCE_GROUP }} -f backend-container/Dockerfile.python backend-container/ | |
deploy: | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
needs: buildImage | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- uses: azure/aks-set-context@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
cluster-name: ${{ secrets.CLUSTER_NAME }} | |
resource-group: ${{ secrets.CLUSTER_RESOURCE_GROUP }} | |
- name: Prepare Deployment Manifest | |
run: | | |
DATE=$(date +%s) | |
sed -i "s/{{.Date}}/$DATE/" manifests/deploy-be.yaml | |
- name: Deploy to Kubernetes | |
run: | | |
kubectl apply -f manifests/deploy-be.yaml | |
kubectl apply -f manifests/svc-be.yaml |