-
Notifications
You must be signed in to change notification settings - Fork 18
110 lines (91 loc) · 3.6 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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: '17'
- 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: '17'
- 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: "Update Docker Hub Description for Cadastrapp"
if: github.ref == 'refs/heads/master' && github.repository == 'georchestra/cadastrapp' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request'
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
repository: georchestra/cadastrapp
readme-filepath: ./DOCKER_HUB.md
short-description: 'Cadastrapp module for the geOrchestra SDI'
- name: "Publish binary in artifactory"
run: ./mvn deploy
continue-on-error: true
env:
ARTIFACTORY_TOKEN_REF: ${{ secrets.ARTIFACTORY_TOKEN }}
ARTIFACTORY_USERNAME_REF: ${{ secrets.ARTIFACTORY_USERNAME }}
- name: Remove SNAPSHOT jars from repository
run: |
find .m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}