-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (61 loc) · 1.87 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Build and Push Docker Image
on:
push:
branches:
- main
jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup-java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Verify with maven
run: mvn clean verify -DskipTests
tests:
runs-on: ubuntu-latest
needs: verify
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup-java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Run tests with maven
run: mvn clean test
build:
runs-on: ubuntu-latest
needs: tests
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DATABASE_USER: ${{ secrets.DATABASE_USER }}
DATABASE_HOST: ${{ secrets.DATABASE_HOST }}
DATABASE_NAME: ${{ secrets.DATABASE_NAME }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
DATABASE_PORT: ${{ secrets.DATABASE_PORT }}
MAIL_TO: ${{ secrets.MAIL_TO }}
MAIL_USERNAME: ${{ secrets.MAIL_USERNAME }}
MAIL_PASSWORD: ${{ secrets.MAIL_PASSWORD }}
PROFILE: ${{ secrets.PROFILE }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup-java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Login to Docker Hub
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- name: Build Docker Image
run: docker build -t $DOCKER_USERNAME/task-list:latest .
- name: Push Docker Image
run: docker push $DOCKER_USERNAME/task-list:latest