Delete main.yml #1
This file contains 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: Build & Deploy Spring app | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-deploy: | |
name: Build and Deploy Spring boot for beginner | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'corretto' | |
java-version: 17 | |
- name: Unit Tests | |
run: mvn -B test --file pom.xml | |
- name: Build the application | |
run: | | |
mvn clean | |
mvn -B package --file pom.xml | |
- name: Build Docker Image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
dockerfile: Dockerfile | |
push: false | |
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/spring-boot-for-beginners:today | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
dockerfile: Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/spring-boot-for-beginners:today |