buildAndRelease.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. name: Release
  2. on:
  3. push:
  4. branches: [ main ]
  5. jobs:
  6. build-and-test:
  7. name: Build and Test
  8. runs-on: ubuntu-latest
  9. steps:
  10. - uses: actions/checkout@v3
  11. - name: Set up JDK
  12. uses: actions/setup-java@v3
  13. with:
  14. java-version: '25'
  15. distribution: 'temurin'
  16. - name: Build with Gradle
  17. run: chmod +x ./gradlew && ./gradlew clean build test
  18. dockerize:
  19. name: Dockerize Application
  20. needs: build-and-test
  21. runs-on: ubuntu-latest
  22. steps:
  23. - uses: actions/checkout@v3
  24. - name: Set up JDK
  25. uses: actions/setup-java@v3
  26. with:
  27. java-version: '25'
  28. distribution: 'temurin'
  29. - name: Build
  30. run: ./gradlew build
  31. - name: Set up Docker Buildx
  32. uses: docker/setup-buildx-action@v2
  33. - name: Login to Docker Hub
  34. uses: docker/login-action@v2
  35. with:
  36. username: ${{ secrets.DOCKERHUB_USERNAME }}
  37. password: ${{ secrets.DOCKERHUB_TOKEN }}
  38. - name: Build and Push Image
  39. run: |
  40. docker buildx create --use
  41. docker buildx build --platform linux/amd64,linux/arm64 -t dbohry/auth-service:latest --push .