This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Spring Boot Maven CI with Wrapper | |
| on: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'corretto' | |
| - name: Grant mvnw permission | |
| run: chmod +x ./mvnw | |
| - name: Build with Maven Wrapper | |
| run: ./mvnw clean package -DskipTests | |
| - name: Upload JAR as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: springboot-jar | |
| path: target/*.jar | |
| # Docker Build & Push | |
| - name: Build Docker Image | |
| run: docker build -t ${{ secrets.DOCKER_USERNAME }}/spring02:latest . | |
| - name: Login to Docker Hub | |
| run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
| - name: Push Docker Image | |
| run: docker push ${{ secrets.DOCKER_USERNAME }}/spring02:latest | |