diff --git a/.github/workflows/main_javawebapp108.yml b/.github/workflows/main_javawebapp108.yml new file mode 100644 index 000000000..e88eb8267 --- /dev/null +++ b/.github/workflows/main_javawebapp108.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 - javaWebApp108 + +on: + push: + branches: + - main + 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: '11' + + - 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: 'javaWebApp108' + slot-name: 'Production' + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_CFC05EF8DE3741E8BAB5D2DCF1D1964B }} + package: '*.jar' diff --git a/.github/workflows/test_javawebapp108(staging).yml b/.github/workflows/test_javawebapp108(staging).yml new file mode 100644 index 000000000..0ed622b11 --- /dev/null +++ b/.github/workflows/test_javawebapp108(staging).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 - javawebapp108 + +on: + push: + branches: + - test + 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: '11' + + - 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: 'Staging' + 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: 'javawebapp108' + slot-name: 'Staging' + publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_890D5BC8896448D7BBD64B19EF3719CC }} + package: '*.jar' diff --git a/src/main/java/com/example/demo/DemoApplication.java b/src/main/java/com/example/demo/DemoApplication.java index f594b5bc3..704ff53c2 100644 --- a/src/main/java/com/example/demo/DemoApplication.java +++ b/src/main/java/com/example/demo/DemoApplication.java @@ -10,11 +10,15 @@ public class DemoApplication { public static void main(String[] args) { + //int a = 10; + //int b = 20; + //int c = a + b; + System.out.println("The sum of a and b is 30"); SpringApplication.run(DemoApplication.class, args); } @RequestMapping("/") String sayHello() { - return "Hello World!"; + return "Hello World, This is the code from Test branch!"; } } diff --git a/src/main/java/com/example/demo/SumOfNumbers1.java b/src/main/java/com/example/demo/SumOfNumbers1.java new file mode 100644 index 000000000..2fd67e9ee --- /dev/null +++ b/src/main/java/com/example/demo/SumOfNumbers1.java @@ -0,0 +1,11 @@ +package com.example.demo; + +public class SumOfNumbers1 + { + public static void main(String args[]) + { + int n1 = 225, n2 = 115, sum; + sum = n1 + n2; + System.out.println("The sum of numbers is"+sum); + } + } diff --git a/target/classes/application.properties b/target/classes/application.properties new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/target/classes/application.properties @@ -0,0 +1 @@ +