-
Notifications
You must be signed in to change notification settings - Fork 18
93 lines (76 loc) · 2.83 KB
/
cadastrapp.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
name: "cadastrapp"
on:
push:
pull_request:
release:
types: [published]
jobs:
build-deb-package:
runs-on: ubuntu-latest
steps:
- name: "Checking out"
uses: actions/checkout@v2
- name: "Setting up Java"
uses: actions/setup-java@v1
with:
java-version: '8.x'
- name: "Maven repository caching"
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: cadastrapp-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: "Build with Maven"
run: mvn -B clean package deb:package -pl cadastrapp -PdebianPackage
- name: Remove SNAPSHOT jars from repository
run: |
find .m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
- name: "copy resulting deb"
run: mkdir -p scratch && cp cadastrapp/target/georchestra-cadastrapp*.deb scratch/
- name: "publish deb as artifact"
uses: actions/upload-artifact@v1
with:
name: cadastrapp.deb
path: scratch/
build-docker:
runs-on: ubuntu-latest
steps:
- name: "Checking out"
uses: actions/checkout@v2
- name: "Setting up Java"
uses: actions/setup-java@v1
with:
java-version: '8.x'
- name: "Maven repository caching"
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: cadastrapp-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Calculating docker image tag
if: github.repository == 'georchestra/cadastrapp'
id: version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: build a docker image
if: github.repository == 'georchestra/cadastrapp'
run: mvn -B clean package docker:build -pl cadastrapp -Pdocker -DdockerImageName=georchestra/cadastrapp:${{ steps.version.outputs.VERSION }}
- name: "Logging in docker.io"
if: github.repository == 'georchestra/cadastrapp'
uses: azure/docker-login@v1
with:
username: '${{ secrets.DOCKER_HUB_USERNAME }}'
password: '${{ secrets.DOCKER_HUB_PASSWORD }}'
- name: "Pushing latest to docker.io"
if: github.repository == 'georchestra/cadastrapp' && github.ref == 'refs/heads/master'
run: |
docker tag georchestra/cadastrapp:${{ steps.version.outputs.VERSION }} georchestra/cadastrapp:latest
docker push georchestra/cadastrapp:latest
- name: "Pushing release tag to docker.io"
if: github.repository == 'georchestra/cadastrapp' && contains(github.ref, 'refs/tags/')
run: |
docker push georchestra/cadastrapp:${{ steps.version.outputs.VERSION }}
- name: Remove SNAPSHOT jars from repository
run: |
find .m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}