-
Notifications
You must be signed in to change notification settings - Fork 8
106 lines (106 loc) · 3.65 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: CI
on:
# Triggers the workflow on push (branch and tag) or pull request events
create:
tags:
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Java and Maven
uses: actions/setup-java@v3
with:
java-version: '18'
distribution: 'temurin'
cache: 'maven'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Maven Package
env:
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
run: |
mvn clean test --batch-mode -s settings.xml
- name: Slack
uses: 8398a7/action-slack@v3
if: ${{ always() }}
with:
status: ${{ job.status }}
fields: repo,message,commit,author,ref,workflow,took,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Java and Maven
uses: actions/setup-java@v3
with:
java-version: '18'
distribution: 'temurin'
cache: 'maven'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Maven Package
env:
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
run: |
mvn clean package --batch-mode -Dmaven.test.skip=true -s settings.xml
- uses: actions/upload-artifact@v2
if: ${{ success() }}
with:
name: service-flow.jar
path: target/service-flow.jar
- name: Slack
uses: 8398a7/action-slack@v3
if: ${{ always() }}
with:
status: ${{ job.status }}
fields: repo,message,commit,author,ref,workflow,took,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
deploy:
runs-on: ubuntu-latest
needs: build
if: ${{ success() && startsWith(github.ref, 'refs/tags/')}}
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: service-flow.jar
path: ${{ github.workspace }}/target
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/*\//}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: boomerangio/flow-service-workflow:latest,boomerangio/flow-service-workflow:${{ steps.get_version.outputs.VERSION }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Slack
uses: 8398a7/action-slack@v3
if: ${{ always() }}
with:
status: ${{ job.status }}
fields: repo,message,commit,author,ref,workflow,took,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}