-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (109 loc) · 4.42 KB
/
new-version.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Create new version
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: false
default: 'warning'
type: choice
options:
- info
- warning
print_tags:
description: 'True to print to STDOUT'
required: false
type: boolean
tags:
description: 'Test scenario tags'
required: false
type: string
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps:
- uses: actions/checkout@v3
- name: Set up maven
uses: s4u/setup-maven-action@v1.2.1
with:
java-version: '11'
maven-version: '3.6.3'
- name: docker login
run: docker login -u=citelibre -p="${{ secrets.PASSWORD_DOCKER_CITELIBRE }}"
- name: Get new version
run: |
version=$(cat VERSION | cut -d'-' -f1)
end=$(cat VERSION | cut -d'-' -f2-)
old_version=$(echo $version | rev)
old_num_version=$(echo $version | rev | cut -d'.' -f 1 | rev)
num_version=$((old_num_version+1))
old_num_version=$(echo $old_num_version | rev)
num_version=$(echo $num_version | rev)
new_version=$(echo $old_version | sed "s/$old_num_version/$num_version/" | rev)
echo "VERSION=${new_version}-${end}">> $GITHUB_ENV
echo "${new_version}-${end}" > VERSION
- name: Display version
run: echo "version $VERSION"
- name: build war ihm
run: cd citelibre-identEZ
- name: build identEZ
run: docker build citelibre-identEZ -t citelibre/ident_ez:ihm-$VERSION
- name: Save identEZ
run: docker save -o citelibre-identEZ.tar citelibre/ident_ez:ihm-$VERSION
- name: Run Trivy vulnerability scanner in tarball mode of rendez vous image
uses: aquasecurity/trivy-action@master
with:
input: /github/workspace/citelibre-identEZ.tar
severity: 'CRITICAL,HIGH'
format: 'sarif'
output: 'trivy-results.sarif'
continue-on-error: true
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
- name: build mysql
run: docker build mysql -t citelibre/ident_ez:db-$VERSION
- name: build matomo
run: docker build matomo -t citelibre/ident_ez:matomo-$VERSION
- name: build solr
run: docker build solr -t citelibre/ident_ez:solr-$VERSION
- name: build keycloak
run: docker build keycloak -t citelibre/ident_ez:keycloak-$VERSION
- name: build kibana
run: docker build kibana -t citelibre/ident_ez:kibana-$VERSION
- name: build elasticsearch
run: docker build elasticsearch -t citelibre/ident_ez:elasticsearch-$VERSION
- name: push images on docker hub
run: |
docker push citelibre/ident_ez:solr-$VERSION
docker push citelibre/ident_ez:db-$VERSION
docker push citelibre/ident_ez:matomo-$VERSION
docker push citelibre/ident_ez:keycloak-$VERSION
docker push citelibre/ident_ez:ihm-$VERSION
docker push citelibre/ident_ez:kibana-$VERSION
docker push citelibre/ident_ez:elasticsearch-$VERSION
- name: update docker compose
run: |
sed -i -e "s/:solr.*$/:solr-$VERSION/g" docker-compose.yml
sed -i -e "s/:matomo.*$/:matomo-$VERSION/g" docker-compose.yml
sed -i -e "s/:db.*$/:db-$VERSION/g" docker-compose.yml
sed -i -e "s/:ihm.*$/:ihm-$VERSION/g" docker-compose.yml
sed -i -e "s/:keycloak.*$/:keycloak-$VERSION/g" docker-compose.yml
sed -i -e "s/:kibana.*$/:kibana-$VERSION/g" docker-compose.yml
sed -i -e "s/:elasticsearch.*$/:elasticsearch-$VERSION/g" docker-compose.yml
cat docker-compose.yml
- name: Commit and push docker compose
run: |
rm -rf citelibre-identEZ/target
git config --global user.name "githubaction"
git config --global user.email "githubaction"
git add docker-compose.yml
git add VERSION
git commit -m "ci(githubaction): update docker compose with version $VERSION" --allow-empty
git push