fix: workflows fix #11
This file contains hidden or 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
| # Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action | |
| # More GitHub Actions for Azure: https://github.com/Azure/actions | |
| name: Build and deploy Java project to Azure Function App - optimo-user | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| env: | |
| AZURE_FUNCTIONAPP_NAME: optimo-user # Azure Function 앱 이름 | |
| PACKAGE_DIRECTORY: '.' # build.gradle이 있는 디렉토리 | |
| JAVA_VERSION: '17' # Java 버전 | |
| jobs: | |
| build-and-deploy: | |
| runs-on: windows-latest | |
| permissions: | |
| id-token: write # JWT 요청용 | |
| contents: read # checkout 권한 | |
| steps: | |
| - name: 'Checkout GitHub Action' | |
| uses: actions/checkout@v4 | |
| - name: Setup Java Sdk ${{ env.JAVA_VERSION }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ env.JAVA_VERSION }} | |
| distribution: 'microsoft' | |
| - name: 'Build Project Using Gradle' | |
| shell: pwsh | |
| run: | | |
| pushd '${{ env.PACKAGE_DIRECTORY }}' | |
| ./gradlew azureFunctionsPackage | |
| popd | |
| - name: Login to Azure | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_F8AB61811A544B2DA83613DAC80C221E }} | |
| tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_9ADCD142DBE34B8CB2C2F533E244BCA9 }} | |
| subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_15F1B4FCE9C8498292F6A71F69D792DE }} | |
| - name: 'Run Azure Functions Action' | |
| uses: Azure/functions-action@v1 | |
| id: fa | |
| with: | |
| app-name: '${{ env.AZURE_FUNCTIONAPP_NAME }}' | |
| slot-name: 'Production' | |
| package: '${{ env.PACKAGE_DIRECTORY }}/build/libs' # Gradle 빌드 결과 경로 | |
| respect-pom-xml: false # pom.xml이 없으니 false로 변경 |