From b0b6b74da3bbdb09d73fc0f66195953b818a487a Mon Sep 17 00:00:00 2001
From: KanchiSravanKumar <159687193+KanchiSravanKumar@users.noreply.github.com>
Date: Sun, 11 Feb 2024 23:49:28 +0530
Subject: [PATCH 1/6] Update README.md
---
README.md | 85 +++++++++++++++++++++++++++++--------------------------
1 file changed, 45 insertions(+), 40 deletions(-)
diff --git a/README.md b/README.md
index 7cf479a..da336ca 100644
--- a/README.md
+++ b/README.md
@@ -1,48 +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
-# Spring Boot Application Example
+name: Build and deploy JAR app to Azure Web App - kanchi-first-app
-[](https://travis-ci.org/mertakdut/Spring-Boot-Sample-Project)
-[](https://coveralls.io/github/mertakdut/Spring-Boot-Sample-Project?branch=master)
+on:
+ push:
+ branches:
+ - master
+ workflow_dispatch:
-This is a sample Java / Maven / Spring Boot application which provides RESTful services. It can be used as a starter project. Currently it is designed to work as [this project](https://github.com/mertakdut/React-Sample-Project)'s backend.
+jobs:
+ build:
+ runs-on: ubuntu-latest
-## Installation Instructions
- You can import the project as a maven application to your favorite IDE. I made my tests by using eclipse jee-2018-12.
-
- If lombok gets in your way, by referring [this answer](https://stackoverflow.com/a/22332248/4130569), you can install lombok by its jar file.
+ steps:
+ - uses: actions/checkout@v4
-## To run the application
-Use one of the several ways of running a Spring Boot application. Below are just three options:
+ - name: Set up Java version
+ uses: actions/setup-java@v1
+ with:
+ java-version: '11'
-1. Build using maven goal (or by using maven wrapper): `mvn clean package` and execute the resulting artifact as follows `java -jar BankApplicationBackend-0.0.1-SNAPSHOT.jar` or
-2. On Unix/Linux based systems: run `mvn clean package` then run the resulting jar as any other executable `./BankApplicationBackend-0.0.1-SNAPSHOT.jar`
-3. Run as a [Docker](https://www.docker.com/) container.
- 1) Clone the repository.
- 2) cd to project root directory.
- 3) `docker build -t demo/bankapp .`
- * If you get a `./mvnw not found` error, just run `mvn -N io.takari:maven:wrapper -Dmaven=3.5.3` while in the root directory of the project.
- 4) `docker run --expose 8080 -p 8080:8080 demo/bankapp`
+ - name: Build with Maven
+ run: mvn clean install
-## To test the application
- 1. Create a user with /api/user/create url.
+ - name: Upload artifact for deployment job
+ uses: actions/upload-artifact@v3
+ 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@v3
+ with:
+ name: java-app
- `$ curl -X POST localhost:8080/api/user/create -d "{\"username\": \"yourUsername\", \"password\": \"yourPassword\", \"tcno\": \"12512561125\"}" -H "Content-Type:application/json"`
- You'll get a response as in below.
-
- `{"username":"yourUsername","tcno":"12512561125"}`
- 2. Generate an access token by /api/login url.
-
- `$ curl -H "Content-Type: application/json" -X POST -d "{\"username\": \"yourUsername\", \"password\": \"yourPassword\"}" http://localhost:8080/api/login`
-
- You'll be getting an access token similar to this.
-
- `eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ5b3VyVXNlcm5hbWUiLCJleHAiOjE1NTI0NDMzNjZ9.0WSCg4vaP7BVeJz8tQnL3s-BYjBB6UWXlQKCZHm1_zqEVIiA8_71Ni7tbPDm2DbW-Qc_fPP9CQF1jKcRC9njFQ`
-
- 3. Use the token to access content available to all authenticated users, through the RESTful API.
-
- Http.Get request example:
- `curl -i -H "Accept: application/json" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ5b3VyVXNlcm5hbWUiLCJleHAiOjE1NTI0NDMzNjZ9.0WSCg4vaP7BVeJz8tQnL3s-BYjBB6UWXlQKCZHm1_zqEVIiA8_71Ni7tbPDm2DbW-Qc_fPP9CQF1jKcRC9njFQ" -X GET http://localhost:8080/api/user/find/all`
-
- Http.Post request example:
- `curl -H "Content-Type: application/json" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ5b3VyVXNlcm5hbWUiLCJleHAiOjE1NTI0NDMzNjZ9.0WSCg4vaP7BVeJz8tQnL3s-BYjBB6UWXlQKCZHm1_zqEVIiA8_71Ni7tbPDm2DbW-Qc_fPP9CQF1jKcRC9njFQ" -X POST -d "{\"username\": \"yourUsername\", \"buying\": \"true\", \"currency\": \"USD\", \"amount\": \"250\"}" http://localhost:8080/api/transaction/create`
+ - name: Deploy to Azure Web App
+ id: deploy-to-webapp
+ uses: azure/webapps-deploy@v2
+ with:
+ app-name: 'kanchi-first-app'
+ slot-name: 'production'
+ package: '*.jar'
+ publish-profile: ${{ secrets.AzureAppService_PublishProfile_5daef4ff31cc463ab8d12b62bbf5721d }}
From df33f4fb0653274e1e8ad36375f2664051cafdce Mon Sep 17 00:00:00 2001
From: KanchiSravanKumar <159687193+KanchiSravanKumar@users.noreply.github.com>
Date: Sun, 11 Feb 2024 23:54:32 +0530
Subject: [PATCH 2/6] Add or update the Azure App Service build and deployment
workflow config
---
.../workflows/patch-1_kanchi-first-app.yml | 62 +++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 .github/workflows/patch-1_kanchi-first-app.yml
diff --git a/.github/workflows/patch-1_kanchi-first-app.yml b/.github/workflows/patch-1_kanchi-first-app.yml
new file mode 100644
index 0000000..50bad1c
--- /dev/null
+++ b/.github/workflows/patch-1_kanchi-first-app.yml
@@ -0,0 +1,62 @@
+# 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 - kanchi-first-app
+
+on:
+ push:
+ branches:
+ - patch-1
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - 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@v3
+ 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 }}
+ permissions:
+ id-token: write #This is required for requesting the JWT
+
+ steps:
+ - name: Download artifact from build job
+ uses: actions/download-artifact@v3
+ with:
+ name: java-app
+
+ - name: Login to Azure
+ uses: azure/login@v1
+ with:
+ client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_5E6BCAAA4B0B41ACABEC5C081AC2958F }}
+ tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_0B571249C42B4038AF62A43DBA77E23C }}
+ subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_9D2371F08006434E808644572EBF47B1 }}
+
+ - name: Deploy to Azure Web App
+ id: deploy-to-webapp
+ uses: azure/webapps-deploy@v2
+ with:
+ app-name: 'kanchi-first-app'
+ slot-name: 'Production'
+ package: '*.jar'
+
\ No newline at end of file
From 0cc214b76a4ee587fe8e3f5de43e5332f636bd4e Mon Sep 17 00:00:00 2001
From: KanchiSravanKumar <159687193+KanchiSravanKumar@users.noreply.github.com>
Date: Sun, 11 Feb 2024 23:57:30 +0530
Subject: [PATCH 3/6] Update pom.xml
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 97f486c..ee6171a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
BankApplicationBackend
- 1.8
+ 11
From a511aeb4eb29f8c17bdc9fa17ab7d9ee256337c9 Mon Sep 17 00:00:00 2001
From: KanchiSravanKumar <159687193+KanchiSravanKumar@users.noreply.github.com>
Date: Mon, 12 Feb 2024 00:03:06 +0530
Subject: [PATCH 4/6] Update pom.xml
---
pom.xml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/pom.xml b/pom.xml
index ee6171a..c26c164 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,6 +78,11 @@
org.springframework.boot
spring-boot-maven-plugin
+ plugin>
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.19.1
+
org.jacoco
jacoco-maven-plugin
From c9b6d4617076333b1dcc933a6e8a4089960e2d22 Mon Sep 17 00:00:00 2001
From: KanchiSravanKumar <159687193+KanchiSravanKumar@users.noreply.github.com>
Date: Mon, 12 Feb 2024 00:04:15 +0530
Subject: [PATCH 5/6] Update pom.xml
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index c26c164..f600c33 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,7 +78,7 @@
org.springframework.boot
spring-boot-maven-plugin
- plugin>
+
org.apache.maven.plugins
maven-surefire-plugin
2.19.1
From 663b4b8de161c58324824dca3bf029a84a56d9b7 Mon Sep 17 00:00:00 2001
From: KanchiSravanKumar <159687193+KanchiSravanKumar@users.noreply.github.com>
Date: Mon, 12 Feb 2024 00:37:52 +0530
Subject: [PATCH 6/6] Add or update the Azure App Service build and deployment
workflow config
---
.github/workflows/patch-1_kanchi-first-app.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/patch-1_kanchi-first-app.yml b/.github/workflows/patch-1_kanchi-first-app.yml
index 50bad1c..9d5e833 100644
--- a/.github/workflows/patch-1_kanchi-first-app.yml
+++ b/.github/workflows/patch-1_kanchi-first-app.yml
@@ -48,9 +48,9 @@ jobs:
- name: Login to Azure
uses: azure/login@v1
with:
- client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_5E6BCAAA4B0B41ACABEC5C081AC2958F }}
- tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_0B571249C42B4038AF62A43DBA77E23C }}
- subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_9D2371F08006434E808644572EBF47B1 }}
+ client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_8FAFF7E8956A418493A6D6955A82E145 }}
+ tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_9D7AB54362434A5F8B6AB31AE16F7BFB }}
+ subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_BCAF6DA67F674F76B60CB02E057E288C }}
- name: Deploy to Azure Web App
id: deploy-to-webapp