Skip to content

Commit ad066c1

Browse files
authored
Merge pull request #497 from georchestra/mapstore_tag_branch_2021.02.xx
force CI to build and tag on branch name (#3501)
2 parents 7fd36db + cd7c2a3 commit ad066c1

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

.github/workflows/mapstore.yml

+16-15
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,13 @@ jobs:
7575
name: mapstore.war
7676
path: scratch/mapstore-${{ github.sha }}.war
7777

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-
8378
- name: "Building docker image"
84-
if: github.repository == 'georchestra/mapstore2-georchestra'
79+
if: github.repository == 'georchestra/mapstore2-georchestra' && github.event_name == 'push'
8580
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+
9085
- name: "Logging in docker.io"
9186
if: github.repository == 'georchestra/mapstore2-georchestra' && github.event_name == 'push'
9287
uses: azure/docker-login@v1
@@ -97,11 +92,17 @@ jobs:
9792
- name: "Pushing latest to docker.io"
9893
if: github.ref == 'refs/heads/master' && github.repository == 'georchestra/mapstore2-georchestra' && github.event_name == 'push'
9994
run: |
100-
docker tag georchestra/mapstore:${{ steps.version.outputs.VERSION }} georchestra/mapstore:latest
95+
docker tag georchestra/mapstore:$GITHUB_REF_NAME georchestra/mapstore:latest
10196
docker push georchestra/mapstore:latest
102-
working-directory: ${{ github.workspace }}
10397
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'
106107
run: |
107-
docker push georchestra/mapstore:${{ steps.version.outputs.VERSION }}
108+
docker push georchestra/mapstore:$GITHUB_REF_NAME

0 commit comments

Comments
 (0)