From f62498685075dc9bbcb19ca436938fa2de554a2e Mon Sep 17 00:00:00 2001 From: RhodAyo Date: Tue, 31 Mar 2026 02:08:48 +0100 Subject: [PATCH 1/5] Add first GitHub Actions workflow --- .github/workflows/main.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..09f6db05d --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,21 @@ +name: vProfile CI/CD Pipeline + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + test: + name: Test the Pipeline + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Print a message + run: echo "Pipeline is running!" + + - name: List project files + run: ls -la \ No newline at end of file From 299b1335c4332291b36123988ebc2ce5913cb26a Mon Sep 17 00:00:00 2001 From: RhodAyo Date: Tue, 31 Mar 2026 02:14:06 +0100 Subject: [PATCH 2/5] Add Java setup --- .github/workflows/main.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 09f6db05d..72131ba37 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,4 +18,13 @@ jobs: run: echo "Pipeline is running!" - name: List project files - run: ls -la \ No newline at end of file + run: ls -la + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'corretto' + + - name: Verify Java is installed + run: java -version From e6b31ff76d2ee938f5535f97d65008757e6b5f19 Mon Sep 17 00:00:00 2001 From: RhodAyo Date: Tue, 31 Mar 2026 02:18:52 +0100 Subject: [PATCH 3/5] Add Maven build step --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 72131ba37..273f7835a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,3 +28,9 @@ jobs: - name: Verify Java is installed run: java -version + + - name: Build with Maven + run: mvn install -DskipTests + + - name: Verify artifact was created + run: ls -la target/*.war From 5eccdc79681237a406e0f7794ad9b5015faadb30 Mon Sep 17 00:00:00 2001 From: RhodAyo Date: Tue, 31 Mar 2026 02:21:30 +0100 Subject: [PATCH 4/5] Add test step --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 273f7835a..cc60ccff7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,9 +28,12 @@ jobs: - name: Verify Java is installed run: java -version - + - name: Build with Maven run: mvn install -DskipTests - name: Verify artifact was created run: ls -la target/*.war + + - name: Run tests + run: mvn test From 40d6c6050494b6d1e6d1791b4e974d797a3410a1 Mon Sep 17 00:00:00 2001 From: RhodAyo Date: Tue, 31 Mar 2026 02:31:58 +0100 Subject: [PATCH 5/5] Add deployment to Beanstalk --- .github/workflows/main.yml | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cc60ccff7..a65cbb23d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,3 +37,52 @@ jobs: - name: Run tests run: mvn test + + deploy: + name: Deploy to Beanstalk + runs-on: ubuntu-latest + needs: test + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'corretto' + + - name: Build artifact + run: mvn install -DskipTests + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + - name: Upload artifact to S3 + run: | + TIMESTAMP=$(date +%Y%m%d%H%M%S) + VERSION_LABEL=vprofile-$TIMESTAMP + aws s3 cp target/vprofile-v2.war \ + s3://${{ secrets.S3_BUCKET }}/$VERSION_LABEL.war + echo "VERSION_LABEL=$VERSION_LABEL" >> $GITHUB_ENV + + - name: Create Beanstalk application version + run: | + aws elasticbeanstalk create-application-version \ + --application-name ${{ secrets.EB_APPLICATION_NAME }} \ + --version-label ${{ env.VERSION_LABEL }} \ + --source-bundle S3Bucket=${{ secrets.S3_BUCKET }},S3Key=${{ env.VERSION_LABEL }}.war + + - name: Deploy to Beanstalk + run: | + aws elasticbeanstalk update-environment \ + --application-name ${{ secrets.EB_APPLICATION_NAME }} \ + --environment-name ${{ secrets.EB_ENVIRONMENT_NAME }} \ + --version-label ${{ env.VERSION_LABEL }} + + - name: Deployment complete + run: echo "Deployed ${{ env.VERSION_LABEL }} to Beanstalk!" \ No newline at end of file