Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
dongchandev committed Aug 26, 2024
1 parent 25049d3 commit 88fef8a
Showing 1 changed file with 12 additions and 31 deletions.
43 changes: 12 additions & 31 deletions .github/workflows/azure-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Inject Secrets into YAML
run: |
sed -i 's#{DB_URL}#${{ secrets.DB_URL }}#' server/src/main/resources/application.yml
Expand All @@ -40,37 +40,18 @@ jobs:
cd server
./gradlew build -x test
- name: Install azd
uses: Azure/[email protected]

- name: Log in with Azure (Federated Credentials)
if: ${{ env.AZURE_CLIENT_ID != '' }}
- name: Log in to Azure Container Registry (ACR)
run: |
azd auth login `
--client-id "$Env:AZURE_CLIENT_ID" `
--federated-credential-provider "github" `
--tenant-id "$Env:AZURE_TENANT_ID"
shell: pwsh
echo ${{ secrets.AZURE_PASSWORD }} | docker login ${{ secrets.AZURE_CONTAINER_REGISTRY }} -u ${{ secrets.AZURE_USERNAME }} --password-stdin
- name: Log in with Azure (Client Credentials)
if: ${{ env.AZURE_CREDENTIALS != '' }}
- name: Build and Push Docker Image
run: |
$info = $Env:AZURE_CREDENTIALS | ConvertFrom-Json -AsHashtable;
Write-Host "::add-mask::$($info.clientSecret)"
azd auth login `
--client-id "$($info.clientId)" `
--client-secret "$($info.clientSecret)" `
--tenant-id "$($info.tenantId)"
shell: pwsh
env:
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}

- name: Provision Infrastructure
run: azd provision --no-prompt
env:
AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }}
cd server
docker build . -t ${{ secrets.AZURE_CONTAINER_REGISTRY }}/server:latest
docker push ${{ secrets.AZURE_CONTAINER_REGISTRY }}/server:latest
- name: Deploy Application
run: azd deploy --no-prompt
- name: Deploy to Azure Container Apps
run: |
az containerapp update --name ${{ vars.AZURE_APP_NAME }} \
--resource-group ${{ vars.AZURE_RESOURCE_GROUP }} \
--image ${{ secrets.AZURE_CONTAINER_REGISTRY }}/server:latest

0 comments on commit 88fef8a

Please sign in to comment.