From f80fad91f4ce36f43041bf188c28f1080affc5fc Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 12:34:34 +0530 Subject: [PATCH 01/14] Create action.yaml --- .github/workflows/action.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/action.yaml diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml new file mode 100644 index 0000000..861ee8d --- /dev/null +++ b/.github/workflows/action.yaml @@ -0,0 +1,18 @@ +name: Java CI with Maven + +on: + push: + branches: [ master ] +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - name: Build with Maven + run: mvn --batch-mode --update-snapshots package From be8240d253eeaa3d82f7a9e4fa65a7f902fc5189 Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 12:35:00 +0530 Subject: [PATCH 02/14] Update action.yaml --- .github/workflows/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index 861ee8d..f570a01 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -5,7 +5,7 @@ on: branches: [ master ] jobs: build: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - uses: actions/checkout@v3 From 2227b3ed523773576b1211915798e6bc9ff6a072 Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 12:47:14 +0530 Subject: [PATCH 03/14] Update action.yaml --- .github/workflows/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index f570a01..cb87eed 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -15,4 +15,4 @@ jobs: java-version: '17' distribution: 'temurin' - name: Build with Maven - run: mvn --batch-mode --update-snapshots package + run: cd docker-java-app && mvn --batch-mode --update-snapshots package From 054181bbdf2492bf86f6c45db45887eb89f3ce02 Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 12:58:48 +0530 Subject: [PATCH 04/14] Update action.yaml --- .github/workflows/action.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index cb87eed..376ff3e 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -3,9 +3,13 @@ name: Java CI with Maven on: push: branches: [ master ] + +env: + AWS_REGION: us-east-1 + jobs: build: - runs-on: self-hosted + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -16,3 +20,12 @@ jobs: distribution: 'temurin' - name: Build with Maven run: cd docker-java-app && mvn --batch-mode --update-snapshots package + + - name: Set up AWS CLI + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + - name: Build and package + run: aws s3 cp target/app.jar s3://mybucket2818/app-java.jar From 9b11da7d95d88cadd707cadf52344aef147d6d33 Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:00:02 +0530 Subject: [PATCH 05/14] Update action.yaml --- .github/workflows/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index 376ff3e..c3eead2 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -9,7 +9,7 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - uses: actions/checkout@v3 From 948f87844cd535c5e3f922f73be9def6d6518f6a Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:03:35 +0530 Subject: [PATCH 06/14] Update action.yaml --- .github/workflows/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index c3eead2..cefdbba 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -28,4 +28,4 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ env.AWS_REGION }} - name: Build and package - run: aws s3 cp target/app.jar s3://mybucket2818/app-java.jar + run: aws s3 cp target/lib/app.jar s3://mybucket2818/app-java.jar From 1723fb1e99b86728110f87ff84e0afa76d5c5113 Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:04:54 +0530 Subject: [PATCH 07/14] Update action.yaml --- .github/workflows/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index cefdbba..028c1bf 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -28,4 +28,4 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ env.AWS_REGION }} - name: Build and package - run: aws s3 cp target/lib/app.jar s3://mybucket2818/app-java.jar + run: aws s3 cp target/lib/junit-platform-commons-1.4.0.jar s3://mybucket2818/app-java.jar From d1143098179f6e9a27edc7df1f9a7e7244b07994 Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:06:03 +0530 Subject: [PATCH 08/14] Update action.yaml --- .github/workflows/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index 028c1bf..d829d90 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -28,4 +28,4 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ env.AWS_REGION }} - name: Build and package - run: aws s3 cp target/lib/junit-platform-commons-1.4.0.jar s3://mybucket2818/app-java.jar + run: aws s3 cp /home/ubuntu/actions-runner/_work/docker-java/docker-java/docker-java-app/target/lib/junit-platform-commons-1.4.0.jar s3://mybucket2818/app-java.jar From 42e89e137924c500a827e1f9d012cd697acdd31d Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:10:52 +0530 Subject: [PATCH 09/14] Update action.yaml --- .github/workflows/action.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index d829d90..23fd05d 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -29,3 +29,14 @@ jobs: aws-region: ${{ env.AWS_REGION }} - name: Build and package run: aws s3 cp /home/ubuntu/actions-runner/_work/docker-java/docker-java/docker-java-app/target/lib/junit-platform-commons-1.4.0.jar s3://mybucket2818/app-java.jar + + - name: Download artifact from S3 + run: + aws s3 cp s3://my-bucket/app-java.jar app.jar + + - name: Deploy artifact to Tomcat + run: | + sudo apt-get update + sudo apt-get install tomcat8 + sudo cp app.jar /var/lib/tomcat8/webapps/ROOT.war + sudo systemctl restart tomcat8 From e34e70b472cb2ea094283e4701606fce8cb9c290 Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:12:24 +0530 Subject: [PATCH 10/14] Update action.yaml --- .github/workflows/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index 23fd05d..f5a712b 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -32,7 +32,7 @@ jobs: - name: Download artifact from S3 run: - aws s3 cp s3://my-bucket/app-java.jar app.jar + aws s3 cp s3://mybucket2818/app-java.jar app.jar - name: Deploy artifact to Tomcat run: | From 8dad8fd089d35aed97ad4d3ab5c59c5a655b9c8c Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 15:44:26 +0530 Subject: [PATCH 11/14] Update action.yaml --- .github/workflows/action.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index f5a712b..7e0dc84 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -35,8 +35,6 @@ jobs: aws s3 cp s3://mybucket2818/app-java.jar app.jar - name: Deploy artifact to Tomcat - run: | - sudo apt-get update - sudo apt-get install tomcat8 - sudo cp app.jar /var/lib/tomcat8/webapps/ROOT.war + run: | + sudo cp app.jar /opt/tomcat/webapps/ROOT.war sudo systemctl restart tomcat8 From 05d304223834d44f97251c1aa91cc6ca8c840887 Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 15:44:52 +0530 Subject: [PATCH 12/14] Update action.yaml --- .github/workflows/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index 7e0dc84..4fddf8e 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -37,4 +37,4 @@ jobs: - name: Deploy artifact to Tomcat run: | sudo cp app.jar /opt/tomcat/webapps/ROOT.war - sudo systemctl restart tomcat8 + sudo systemctl restart tomcat From d3240a43dd9a4726610ca29a6b254e4f93666a3f Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 17:00:21 +0530 Subject: [PATCH 13/14] Update action.yaml --- .github/workflows/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index 4fddf8e..5a52b0d 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -36,5 +36,5 @@ jobs: - name: Deploy artifact to Tomcat run: | - sudo cp app.jar /opt/tomcat/webapps/ROOT.war + sudo cp app.jar /opt/tomcat/webapps sudo systemctl restart tomcat From a4bb13a798a0bf4acc5a9150fd13db6e894bec99 Mon Sep 17 00:00:00 2001 From: Pavithra Rajendran <96110886+Pavithra137@users.noreply.github.com> Date: Mon, 6 Feb 2023 17:01:49 +0530 Subject: [PATCH 14/14] Update action.yaml --- .github/workflows/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action.yaml b/.github/workflows/action.yaml index 5a52b0d..3cd22ec 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/action.yaml @@ -36,5 +36,5 @@ jobs: - name: Deploy artifact to Tomcat run: | - sudo cp app.jar /opt/tomcat/webapps + sudo cp app.jar /home/ubuntu/apache-tomcat-8.5.85/webapps sudo systemctl restart tomcat