-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (64 loc) · 2.73 KB
/
maven.yaml
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
name: Java CI with Maven
on:
push:
branches:
- main
- '1.*'
tags:
- '*'
pull_request:
env:
BRANCH_NAME: ${{ github.base_ref || github.ref_name }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: latest
- name: Build with Maven
run: ./mvnw verify --file pom.xml -ntp
- name: Build a docker image
run: ./mvnw clean package -Pdocker -ntp
- name: "Resolve docker image tag"
id: version
run: echo ::set-output name=VERSION::$(./mvnw -f src/services/ogc-features/ help:evaluate -q -DforceStdout -Dexpression=project.version -ntp)
- name: Login to DockerHub
if: github.repository == 'georchestra/data-api' && github.actor != 'dependabot[bot]' && (github.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/tags/v'))
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: push the lastest docker image
if: github.repository == 'georchestra/data-api' && github.actor != 'dependabot[bot]' && github.ref == 'refs/heads/main'
run: |
docker push georchestra/data-api:latest
- name: push the release tag docker image
if: github.repository == 'georchestra/data-api' && github.actor != 'dependabot[bot]' && startsWith(github.event.ref, 'refs/tags/v')
run: |
docker push georchestra/data-api:${{ steps.version.outputs.VERSION }}
- name: push the release branch docker image
if: github.repository == 'georchestra/data-api' && github.actor != 'dependabot[bot]' && contains(github.ref, 'refs/heads/1.')
run: |
docker tag georchestra/data-api:latest georchestra/data-api:${{ env.BRANCH_NAME }}
docker push georchestra/data-api:${{ env.BRANCH_NAME }}
- name: "Update Docker Hub Description"
if: github.ref == 'refs/heads/main' && github.repository == 'georchestra/data-api' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request'
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: georchestra/data-api
readme-filepath: ./DOCKER_HUB.md
short-description: 'OGC API Features implementation module for the geOrchestra SDI'
- name: "Remove SNAPSHOT jars from repository"
run: |
find .m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}