-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (64 loc) · 2.35 KB
/
actions.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: CI/CD Actions
on:
push:
branches: [master] # Branch push edildiginde tetikler
pull_request:
branches: [master] # Pull request acildiginda tetikler
jobs:
test:
name: Unit Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3 # Kodu al
- name: Set up JDK 17
uses: actions/setup-java@v3 # JDK 17'yi yapilandir
with:
java-version: '17'
distribution: 'corretto'
cache: 'maven'
- name: Build with Maven
run: mvn -B package --file pom.xml # Maven ile derle
- name: Cache Maven packages
uses: actions/cache@v3 # Maven paketlerini onbellege al
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Run Tests
run: mvn -B test # Testleri calistir
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4 # Kodu al
- name: Set up JDK 17
uses: actions/setup-java@v3 # JDK 17'yi yapilandir
with:
java-version: '17'
distribution: 'corretto'
cache: 'maven'
- name: Build with Maven
run: mvn -B package --file pom.xml -DskipTests # Maven ile derle
- name: Cache Maven packages
uses: actions/cache@v3 # Maven paketlerini onbellege al
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 # Docker Buildx'i yapilandir
- name: Login to Docker Hub
uses: docker/login-action@v3 # Docker Hub'a giris yap
with:
username: ${{ secrets.DOCKER_USERNAME }} # Docker kullanici adi
password: ${{ secrets.DOCKER_PASSWORD }} # Docker parola
- name: Build and push
uses: docker/build-push-action@v5 # Imaji olustur ve yayinla
with:
image: mgmetehanx/githubactionsdemo # Docker imaji adi
tags: latest # Etiket adi
registry: docker.io # Docker hub adresi
dockerfile: Dockerfile # Docker dosyasi
username: ${{ secrets.DOCKER_USERNAME }} # Docker kullanici adi
password: ${{ secrets.DOCKER_PASSWORD }} # Docker parola