@@ -75,18 +75,13 @@ jobs:
75
75
name : mapstore.war
76
76
path : scratch/mapstore-${{ github.sha }}.war
77
77
78
- - name : Getting image tag
79
- if : github.repository == 'georchestra/mapstore2-georchestra'
80
- id : version
81
- run : echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
82
-
83
78
- name : " Building docker image"
84
- if : github.repository == 'georchestra/mapstore2-georchestra'
79
+ if : github.repository == 'georchestra/mapstore2-georchestra' && github.event_name == 'push'
85
80
run : |
86
- cp scratch/mapstore-${{ github.sha }}.war docker/MapStore-${{ steps.version.outputs.VERSION } }.war
87
- docker build . -t georchestra/mapstore:${{ steps.version.outputs.VERSION }}
88
- # mvn -B package dockerfile:build -Pdocker,log4j-logstash,sentry-log4j -DdockerImageName=georchestra/mapstore:${{ steps.version.outputs.VERSION }} -settings settings.xml
89
- working-directory : ${{ github.workspace }}
81
+ cp scratch/mapstore-${{ github.sha }}.war docker/MapStore-${GITHUB_REF_NAME }.war
82
+ docker build . -t georchestra/mapstore:$GITHUB_REF_NAME
83
+ # mvn -B package dockerfile:build -Pdocker,log4j-logstash,sentry-log4j -DdockerImageName=georchestra/mapstore:$GITHUB_REF_NAME -settings settings.xml
84
+
90
85
- name : " Logging in docker.io"
91
86
if : github.repository == 'georchestra/mapstore2-georchestra' && github.event_name == 'push'
92
87
uses : azure/docker-login@v1
@@ -97,11 +92,17 @@ jobs:
97
92
- name : " Pushing latest to docker.io"
98
93
if : github.ref == 'refs/heads/master' && github.repository == 'georchestra/mapstore2-georchestra' && github.event_name == 'push'
99
94
run : |
100
- docker tag georchestra/mapstore:${{ steps.version.outputs.VERSION }} georchestra/mapstore:latest
95
+ docker tag georchestra/mapstore:$GITHUB_REF_NAME georchestra/mapstore:latest
101
96
docker push georchestra/mapstore:latest
102
- working-directory : ${{ github.workspace }}
103
97
104
- - name : " Pushing tag to docker.io"
105
- if : contains(github.ref, 'refs/tags/') && github.repository == 'georchestra/mapstore2-georchestra' && github.event_name == 'push'
98
+ - name : " Check if branch name matches 20YY.MM.XX release pattern"
99
+ id : check-branch
100
+ run : |
101
+ if [[ ${{ github.ref_name }} =~ ^20[0-9]{2}\.[0-9]{2}\..+$ ]]; then
102
+ echo "::set-output name=releasematch::true"
103
+ fi
104
+
105
+ - name : " Pushing release to docker.io"
106
+ if : steps.check-branch.outputs.releasematch == 'true' && github.repository == 'georchestra/mapstore2-georchestra' && github.event_name == 'push'
106
107
run : |
107
- docker push georchestra/mapstore:${{ steps.version.outputs.VERSION }}
108
+ docker push georchestra/mapstore:$GITHUB_REF_NAME
0 commit comments