From 737bc7d9369c56ad64cd89cb4252d27c017605c9 Mon Sep 17 00:00:00 2001 From: "Marcio J. Costa" <87935294+MarcioCosta013@users.noreply.github.com> Date: Sat, 13 Dec 2025 01:27:30 -0300 Subject: [PATCH 1/5] Update CI workflow to use JDK 21 and develop branch --- .github/workflows/ci-develop.yml | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/ci-develop.yml diff --git a/.github/workflows/ci-develop.yml b/.github/workflows/ci-develop.yml new file mode 100644 index 0000000..3fbfeb4 --- /dev/null +++ b/.github/workflows/ci-develop.yml @@ -0,0 +1,33 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: CI Develop + +on: + push: + branches: [ "develop" ] + pull_request: + branches: [ "develop" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: maven + - name: Run Maven verify (tests + Spotless + SpotBugs) + run: mvn -B clean verifyl From 5e97d220268c9ea9e6fb5ef58c578ac5e97c545c Mon Sep 17 00:00:00 2001 From: "Marcio J. Costa" <87935294+MarcioCosta013@users.noreply.github.com> Date: Sat, 13 Dec 2025 02:42:52 -0300 Subject: [PATCH 2/5] Add CD workflow for main branch with Docker build --- .github/workflows/cd-main.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/cd-main.yml diff --git a/.github/workflows/cd-main.yml b/.github/workflows/cd-main.yml new file mode 100644 index 0000000..30dcacd --- /dev/null +++ b/.github/workflows/cd-main.yml @@ -0,0 +1,37 @@ +name: CD main (Prod) + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: maven + + - name: Run Maven verify (tests + Spotless + SpotBugs) + run: mvn -B clean verify + + docker: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build Docker image + run: docker build -t vemprofut-api:latest . + + From 4bf034a5da9b1b57309353b7563cb80ea327b891 Mon Sep 17 00:00:00 2001 From: "Marcio J. Costa" <87935294+MarcioCosta013@users.noreply.github.com> Date: Sat, 13 Dec 2025 03:04:22 -0300 Subject: [PATCH 3/5] Rename cd-main.yml to cicd-main.yml adicionei as secrets --- .github/workflows/{cd-main.yml => cicd-main.yml} | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) rename .github/workflows/{cd-main.yml => cicd-main.yml} (61%) diff --git a/.github/workflows/cd-main.yml b/.github/workflows/cicd-main.yml similarity index 61% rename from .github/workflows/cd-main.yml rename to .github/workflows/cicd-main.yml index 30dcacd..e76da07 100644 --- a/.github/workflows/cd-main.yml +++ b/.github/workflows/cicd-main.yml @@ -1,4 +1,4 @@ -name: CD main (Prod) +name: CI/CD Main (Prod) on: push: @@ -31,7 +31,16 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Log in to Docker Hub + run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + - name: Build Docker image run: docker build -t vemprofut-api:latest . - + - name: Tag Docker image + run: docker tag vemprofut-api:latest ${{ secrets.DOCKER_USERNAME }}/vemprofut-api:latest + + - name: Push Docker image + run: docker push ${{ secrets.DOCKER_USERNAME }}/vemprofut-api:latest + + From 69738fe112714fbc3cbb7a278edacf9a99164538 Mon Sep 17 00:00:00 2001 From: "Marcio J. Costa" <87935294+MarcioCosta013@users.noreply.github.com> Date: Sat, 13 Dec 2025 03:17:22 -0300 Subject: [PATCH 4/5] Specify working directory for Maven verify Set working directory for Maven verify step. --- .github/workflows/cicd-main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cicd-main.yml b/.github/workflows/cicd-main.yml index e76da07..bb8800a 100644 --- a/.github/workflows/cicd-main.yml +++ b/.github/workflows/cicd-main.yml @@ -23,6 +23,7 @@ jobs: - name: Run Maven verify (tests + Spotless + SpotBugs) run: mvn -B clean verify + working-directory: ./VemProFutApi docker: runs-on: ubuntu-latest From 0f52934098cd774745ce54a4fc559c88aec06cd9 Mon Sep 17 00:00:00 2001 From: "Marcio J. Costa" <87935294+MarcioCosta013@users.noreply.github.com> Date: Sat, 13 Dec 2025 21:48:58 -0300 Subject: [PATCH 5/5] Change Docker build context to VemProFutApi directory --- .github/workflows/cicd-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd-main.yml b/.github/workflows/cicd-main.yml index bb8800a..ad14fa4 100644 --- a/.github/workflows/cicd-main.yml +++ b/.github/workflows/cicd-main.yml @@ -36,7 +36,7 @@ jobs: run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin - name: Build Docker image - run: docker build -t vemprofut-api:latest . + run: docker build -t vemprofut-api:latest ./VemProFutApi - name: Tag Docker image run: docker tag vemprofut-api:latest ${{ secrets.DOCKER_USERNAME }}/vemprofut-api:latest