buildAndRelease.yml 754 B

123456789101112131415161718192021222324252627282930
  1. name: Release
  2. on:
  3. push:
  4. branches: [ main ]
  5. jobs:
  6. build:
  7. runs-on: ubuntu-latest
  8. steps:
  9. - uses: actions/checkout@v3
  10. - name: Set up JDK
  11. uses: actions/setup-java@v3
  12. with:
  13. java-version: '17' # or the version you use
  14. distribution: 'temurin' # or another distribution
  15. - name: Build with Maven
  16. run: chmod +x ./mvnw && ./mvnw clean package test
  17. - name: Build the Docker image
  18. run: ./mvnw spring-boot:build-image
  19. - name: Login to Docker Hub
  20. uses: docker/login-action@v2
  21. with:
  22. username: ${{ secrets.DOCKERHUB_USERNAME }}
  23. password: ${{ secrets.DOCKERHUB_TOKEN }}
  24. - name: Push image
  25. run: docker push stocks-be:0.1