This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
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: Deploy to Azure Container Apps | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- backend | ||
permissions: | ||
id-token: write | ||
contents: read | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | ||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
AZURE_RESOURCE_GROUP: ${{ secrets.AZURE_RESOURCE_GROUP }} | ||
AZURE_LOCATION: ${{ secrets.AZURE_LOCATION }} | ||
AZURE_ENV_NAME: ${{ secrets.AZURE_ENV_NAME }} # 환경 이름 설정 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- name: Set yml file | ||
uses: microsoft/variable-substitution@v1 | ||
with: | ||
files: src/main/resources/application.yml | ||
env: | ||
spring.datasource.url: ${{ secrets.DB_URL }} | ||
spring.datasource.username: ${{ secrets.DB_USERNAME }} | ||
spring.datasource.password: ${{ secrets.DB_PASSWORD }} | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
- name: List build/libs contents | ||
run: ls -la build/libs | ||
- name: Docker build | ||
run: | | ||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | ||
docker build -t ${{ secrets.DOCKER_USERNAME }}/uiseong-come-on . | ||
docker push ${{ secrets.DOCKER_USERNAME }}/uiseong-come-on:latest | ||
- name: Install azd | ||
uses: Azure/[email protected] | ||
- name: Log in with Azure (Federated Credentials) | ||
if: ${{ secrets.AZURE_CLIENT_ID != '' }} | ||
Check failure on line 62 in .github/workflows/azure-dev.yml GitHub Actions / Deploy to Azure Container AppsInvalid workflow file
|
||
run: | | ||
azd auth login \ | ||
--client-id "${{ secrets.AZURE_CLIENT_ID }}" \ | ||
--federated-credential-provider "github" \ | ||
--tenant-id "${{ secrets.AZURE_TENANT_ID }}" | ||
- name: Log in with Azure (Client Credentials) | ||
if: ${{ secrets.AZURE_CREDENTIALS != '' }} | ||
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 --environment ${{ env.AZURE_ENV_NAME }} --no-prompt | ||
env: | ||
AZD_INITIAL_ENVIRONMENT_CONFIG: ${{ secrets.AZD_INITIAL_ENVIRONMENT_CONFIG }} | ||
- name: Deploy Application | ||
run: | | ||
azd deploy --environment ${{ env.AZURE_ENV_NAME }} --no-prompt |