From 0fe95c92f388f07ff1b78695cc32b4645cda184c Mon Sep 17 00:00:00 2001 From: "Eric.Hui" Date: Thu, 3 Aug 2023 23:42:12 +0800 Subject: [PATCH 1/2] Add or update the Azure App Service build and deployment workflow config --- .github/workflows/dev-spring_hyh.yml | 53 ++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/dev-spring_hyh.yml diff --git a/.github/workflows/dev-spring_hyh.yml b/.github/workflows/dev-spring_hyh.yml new file mode 100644 index 000000000..b69d24947 --- /dev/null +++ b/.github/workflows/dev-spring_hyh.yml @@ -0,0 +1,53 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy JAR app to Azure Web App - hyh + +on: + push: + branches: + - dev/spring + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Java version + uses: actions/setup-java@v1 + with: + java-version: '17' + + - name: Build with Maven + run: mvn clean install + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v2 + with: + name: java-app + path: '${{ github.workspace }}/target/*.jar' + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'Production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v2 + with: + name: java-app + + - name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: 'hyh' + slot-name: 'Production' + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_E216D203B1A54763B1CB9F90A54D2284 }} + package: '*.jar' From 7b63e00f3870ed71c648ffeb26b86d49b00eb522 Mon Sep 17 00:00:00 2001 From: huiyh Date: Thu, 3 Aug 2023 23:49:47 +0800 Subject: [PATCH 2/2] test deploy --- .gitignore | 6 ++++++ README.md | 4 +++- src/main/java/com/example/demo/DemoApplication.java | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a1c2a238a..b067cd5b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ +# mac +.DS_Store + +# jetbrains +.idea + # Compiled class file *.class diff --git a/README.md b/README.md index 6deca5125..fa3951c11 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,6 @@ This Hello World application is based off of the code generated by Spring Initia # Contributing -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +* This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +* For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) + with any additional questions or comments. diff --git a/src/main/java/com/example/demo/DemoApplication.java b/src/main/java/com/example/demo/DemoApplication.java index f594b5bc3..5fe375bca 100644 --- a/src/main/java/com/example/demo/DemoApplication.java +++ b/src/main/java/com/example/demo/DemoApplication.java @@ -15,6 +15,6 @@ public static void main(String[] args) { @RequestMapping("/") String sayHello() { - return "Hello World!"; + return "Hello World!\n I'm Azure."; } }