-
Notifications
You must be signed in to change notification settings - Fork 25
117 lines (98 loc) · 4.19 KB
/
mapstore.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
111
112
113
114
115
116
117
name: "mapstore"
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: "checking out"
uses: actions/checkout@v2
with:
# 0 gets tags, needed for debian package
fetch-depth: 0
submodules: 'recursive'
- name: "setting up Java"
uses: actions/setup-java@v1
with:
java-version: '11'
server-id: geOrchestra-artifactory
server-username: ARTIFACTORY_USERNAME_REF
server-password: ARTIFACTORY_TOKEN_REF
- name: "setting up npm"
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: "cache node modules"
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: "Maven repository caching"
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: mapstore-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
mapstore-${{ runner.os }}-maven-
- name: "install dependencies"
run: npm install
- name: "build"
run: npm run compile
- name: "run lint"
run: npm run lint
- name: "package with Maven"
run: mvn -B clean install -Dmapstore2.version=${{ github.sha }}
- name: "deploy war in artifactory"
run: cd web && mvn -B deploy -Dmapstore2.version=${{ github.sha }}
continue-on-error: true
env:
ARTIFACTORY_TOKEN_REF: ${{ secrets.ARTIFACTORY_TOKEN }}
ARTIFACTORY_USERNAME_REF: ${{ secrets.ARTIFACTORY_USERNAME }}
- name: "debian package with Maven"
run: mvn -B package deb:package -pl web -PdebianPackage
- name: "copy resulting deb"
run: mkdir -p scratch && cp web/target/georchestra-mapstore*.deb scratch/georchestra-mapstore-${{ github.sha }}.deb
- name: "publish deb as artifact"
uses: actions/upload-artifact@v1
with:
name: georchestra-mapstore.deb
path: scratch/georchestra-mapstore-${{ github.sha }}.deb
- name: "copy resulting war"
run: mkdir -p scratch && cp web/target/mapstore.war scratch/mapstore-${{ github.sha }}.war
- name: "publish war as artifact"
uses: actions/upload-artifact@v1
with:
name: mapstore.war
path: scratch/mapstore-${{ github.sha }}.war
- name: Getting image tag
if: github.repository == 'georchestra/mapstore2-georchestra'
id: version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: "Building docker image"
if: github.repository == 'georchestra/mapstore2-georchestra'
run: |
cp scratch/mapstore-${{ github.sha }}.war docker/MapStore-${{ steps.version.outputs.VERSION }}.war
docker build . -t georchestra/mapstore:${{ steps.version.outputs.VERSION }}
# mvn -B package dockerfile:build -Pdocker,log4j-logstash,sentry-log4j -DdockerImageName=georchestra/mapstore:${{ steps.version.outputs.VERSION }} -settings settings.xml
working-directory: ${{ github.workspace }}
- name: "Logging in docker.io"
if: github.repository == 'georchestra/mapstore2-georchestra' && github.event_name == 'push'
uses: azure/docker-login@v1
with:
username: '${{ secrets.DOCKER_HUB_USERNAME }}'
password: '${{ secrets.DOCKER_HUB_PASSWORD }}'
- name: "Pushing latest to docker.io"
if: github.ref == 'refs/heads/master' && github.repository == 'georchestra/mapstore2-georchestra' && github.event_name == 'push'
run: |
docker tag georchestra/mapstore:${{ steps.version.outputs.VERSION }} georchestra/mapstore:latest
docker push georchestra/mapstore:latest
working-directory: ${{ github.workspace }}
- name: "Pushing tag to docker.io"
if: contains(github.ref, 'refs/tags/') && github.repository == 'georchestra/mapstore2-georchestra' && github.event_name == 'push'
run: |
docker push georchestra/mapstore:${{ steps.version.outputs.VERSION }}