-
Notifications
You must be signed in to change notification settings - Fork 4
79 lines (67 loc) · 1.97 KB
/
docker.yaml
File metadata and controls
79 lines (67 loc) · 1.97 KB
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
name: Build snapshot docker image
on:
push:
branches-ignore:
- main
jobs:
build-snapshot:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.extract_branch.outputs.branch }}
steps:
- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
id: extract_branch
- uses: actions/checkout@v4
with:
ref: ${{ steps.extract_branch.outputs.branch }}
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- name: Clone BPM
uses: actions/checkout@master
with:
repository: InseeFr/BPM
path: bpm
- name: Build BPM
run: |
cd bpm
mvn clean install --no-transfer-progress
cd ..
- name: Build API
run: mvn package --no-transfer-progress
- name: Upload API jar
uses: actions/upload-artifact@v4
with:
name: app-jar
path: target/*.jar
docker:
needs:
- build-snapshot
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download uploaded jar
uses: actions/download-artifact@v4
with:
name: app-jar
path: target/
- name: Create docker version tag
id: docker-version
run: |
# replace '/' by '-' for docker tags
docker_tag="${{ needs.build-snapshot.outputs.branch }}"
docker_tag=$(echo "$docker_tag" | sed 's/[\/+]/-/g')
echo "docker_tag=${docker_tag}" >> $GITHUB_ENV
- name: Publish to Docker Hub
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: inseefr/genesis-api
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
default_branch: ${{ github.ref }}
tags: "snapshot-${{ env.docker_tag }}"
workdir: .