This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25049d3
commit 88fef8a
Showing
1 changed file
with
12 additions
and
31 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 |