Skip to content

Delete main.yml

Delete main.yml #1

Workflow file for this run

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