diff --git a/.github/workflows/03-minhas-actions.yaml b/.github/workflows/03-minhas-actions.yaml new file mode 100644 index 0000000..e5a39da --- /dev/null +++ b/.github/workflows/03-minhas-actions.yaml @@ -0,0 +1,29 @@ +name: 03 - Actions 1.0 + +on: + push: + branches: "feature/**" + +jobs: + checkout_java_docker: + runs-on: ubuntu-latest + steps: + - name: Git Checkout + uses: actions/checkout@v4 + + - name: Setup Java SDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - name: Build + uses: docker/build-push-action@v6 + with: + push: false + + - name: Executar scripts + run: | + git branch + java --version + mvn clean package \ No newline at end of file diff --git a/.github/workflows/continuous_integration.yaml b/.github/workflows/continuous_integration.yaml new file mode 100644 index 0000000..dbe3fd2 --- /dev/null +++ b/.github/workflows/continuous_integration.yaml @@ -0,0 +1,45 @@ +on: + push: + branches: "feature/main" + +env: + IMAGE_NAME: simple-api-java + AZURE_WEBAPP_NAME: simple-api-java + +jobs: + build: + runs-on: ubuntu-latest + steps: + - + name: Git Checkout + uses: actions/checkout@v4 + + - name: Setup Java SDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest + deploy: + runs-on: ubuntu-latest + needs: build + steps: + - + name: Deploy to Azure Web App + id: deploy-to-webapp + uses: azure/webapps-deploy@v2 + with: + app-name: ${{ env.AZURE_WEBAPP_NAME }} + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} + images: 'ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest' \ No newline at end of file diff --git a/README.md b/README.md index 541f35a..fc2da66 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Aplicação API docker compose up --build ``` -## Testes unitários (validação) +## Testes unitários (validação.) ./mvnw test