-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (87 loc) · 2.52 KB
/
ci.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
78
79
80
81
82
83
84
85
86
87
88
89
name: CI
on:
push:
branches:
- 'master'
tags:
- '**'
pull_request:
branches:
- 'master'
jobs:
test-and-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Run Tests & Build JAR
run: ./gradlew clean build jacocoTestReport
- name: Upload JAR File
uses: actions/upload-artifact@v2
with:
name: jar_file
path: server-spring/build/libs/kotlink.jar
- name: Report Detekt Issues
if: github.ref == 'refs/heads/master'
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: build/reports/detekt/detekt.sarif
- name: Report Code Coverage
uses: codecov/codecov-action@v1
docker-image-for-master:
runs-on: ubuntu-latest
needs: test-and-build
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Download JAR File
uses: actions/download-artifact@v2
with:
name: jar_file
path: server-spring/build/libs/
- name: Login To DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & Push Image
uses: docker/build-push-action@v2
with:
context: ./server-spring/
platforms: linux/amd64
push: true
tags: ilya40umov/kotlink:develop
docker-image-for-tag:
runs-on: ubuntu-latest
needs: test-and-build
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v2
- name: Download JAR File
uses: actions/download-artifact@v2
with:
name: jar_file
path: server-spring/build/libs/
- name: Login To DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ilya40umov/kotlink
- name: Compute Tag Name
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Build & Push Image
uses: docker/build-push-action@v2
with:
context: ./server-spring/
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}