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 diff --git a/.github/workflows/cicd-main.yml b/.github/workflows/cicd-main.yml new file mode 100644 index 0000000..ad14fa4 --- /dev/null +++ b/.github/workflows/cicd-main.yml @@ -0,0 +1,47 @@ +name: CI/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 + working-directory: ./VemProFutApi + + docker: + runs-on: ubuntu-latest + needs: build + steps: + - 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 ./VemProFutApi + + - 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 + +