fix workflow10 #136
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
#fix | |
name: fe | |
"on": | |
push: | |
branches: | |
- main | |
workflow_dispatch: {} | |
env: | |
DEPLOYMENT_MANIFEST_PATH: | | |
manifests/deploy-fe.yaml | |
manifests/svc-fe.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 | |
env: | |
VITE_COGNITO_USER_POOL_ID: ${{ secrets.VITE_COGNITO_USER_POOL_ID }} | |
VITE_COGNITO_CLIENT_ID: ${{ secrets.VITE_COGNITO_CLIENT_ID }} | |
run: | | |
az acr build --image fe:latest --registry ${{ secrets.AZURE_CONTAINER_REGISTRY }} -g ${{ secrets.ACR_RESOURCE_GROUP }} -f frontend-container/Dockerfile.Prod frontend-container/ | |
deploy: | |
permissions: | |
contents: read | |
id-token: write | |
runs-on: ubuntu-latest | |
needs: buildImage | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: azure/login@v2 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
enable-AzPSSession: false | |
environment: azurecloud | |
- 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-fe.yaml | |
- name: Deploy to Kubernetes | |
run: | | |
kubectl apply -f manifests/deploy-fe.yaml | |
kubectl apply -f manifests/svc-fe.yaml |