1- # Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
2- # More GitHub Actions for Azure: https://github.com/Azure/actions
31name : Build and deploy Java project to Azure Function App - optimo-user
42
53on :
97 workflow_dispatch :
108
119env :
12- AZURE_FUNCTIONAPP_NAME : optimo-user # Azure Function 앱 이름
13- PACKAGE_DIRECTORY : ' .' # build.gradle이 있는 디렉토리
14- JAVA_VERSION : ' 17' # Java 버전
10+ AZURE_FUNCTIONAPP_NAME : optimo-user
11+ JAVA_VERSION : ' 17'
1512
1613jobs :
1714 build-and-deploy :
1815 runs-on : windows-latest
1916 permissions :
20- id-token : write # JWT 요청용
21- contents : read # checkout 권한
17+ id-token : write
18+ contents : read
2219
2320 steps :
24- - name : ' Checkout GitHub Action '
21+ - name : Checkout repository
2522 uses : actions/checkout@v4
2623
27- - name : Setup Java Sdk ${{ env.JAVA_VERSION }}
24+ - name : Setup Java ${{ env.JAVA_VERSION }}
2825 uses : actions/setup-java@v4
2926 with :
3027 java-version : ${{ env.JAVA_VERSION }}
3128 distribution : ' microsoft'
3229
33- - name : ' Build Project Using Gradle '
30+ - name : Grant gradlew execute permission
3431 shell : pwsh
3532 run : |
36- pushd '${{ env.PACKAGE_DIRECTORY }}'
37- ./gradlew clean azureFunctionsPackage
38- popd
33+ if (Test-Path "gradlew") {
34+ icacls gradlew /grant:r "$env:USERNAME:(RX)"
35+ }
36+
37+ - name : Build with Gradle
38+ shell : pwsh
39+ run : |
40+ ./gradlew clean build --stacktrace --info
41+ ls -R build/libs # 빌드 결과 확인
42+
43+ - name : Package Azure Functions
44+ shell : pwsh
45+ run : |
46+ ./gradlew azureFunctionsPackage --stacktrace
3947
4048 - name : Login to Azure
4149 uses : azure/login@v2
4452 tenant-id : ${{ secrets.AZUREAPPSERVICE_TENANTID_9ADCD142DBE34B8CB2C2F533E244BCA9 }}
4553 subscription-id : ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_15F1B4FCE9C8498292F6A71F69D792DE }}
4654
47- - name : ' Run Azure Functions Action '
55+ - name : Deploy to Azure Functions
4856 uses : Azure/functions-action@v1
49- id : fa
5057 with :
51- app-name : ' ${{ env.AZURE_FUNCTIONAPP_NAME }}'
52- slot-name : ' Production'
53- package : ' ${{ env.PACKAGE_DIRECTORY }}/build/libs' # Gradle 빌드 결과 경로
54- respect-pom-xml : false # pom.xml이 없으니 false로 변경
58+ app-name : ${{ env.AZURE_FUNCTIONAPP_NAME }}
59+ package : build/azure-functions/${{ env.AZURE_FUNCTIONAPP_NAME }}
60+ publish-profile : ${{ secrets.AZURE_PUBLISH_PROFILE }}
0 commit comments