@@ -401,22 +401,35 @@ jobs:
401401
402402 docker :
403403 needs : parse
404- if : ${{ github.repository == 'Ericsson/CodeCompass' && github.ref == 'refs/heads/ master' }}
404+ if : ${{ github.repository == 'Ericsson/CodeCompass' && ( github.ref_name == 'master' || startsWith(github.ref_name, 'release') == true) }}
405405 runs-on : ubuntu-20.04
406406
407407 steps :
408408 - name : Checkout
409409 uses : actions/checkout@v2
410410
411+ - name : Branch name slug
412+ uses : rlespinasse/github-slug-action@v4
413+
414+ - name : Branch name substring
415+ uses : bhowell2/github-substring-action@v1.0.0
416+ id : branch_substring
417+ with :
418+ value : ${{ env.GITHUB_REF_SLUG }}
419+ index_of_str : " release"
420+ fail_if_not_found : false
421+ default_return_value : " "
422+
411423 - name : Build images
412- id : docker_build
424+ if : ${{ github.ref_name == 'master' || startsWith(github.ref_name, 'release') == true }}
413425 run : |
414- docker build -t codecompass:dev -t modelcpp/codecompass:dev --file docker/dev/Dockerfile .
415- docker build -t codecompass:runtime -t modelcpp/codecompass:runtime-sqlite --file docker/runtime/Dockerfile --no-cache --build-arg CC_DATABASE=sqlite .
416- docker build -t codecompass:web -t modelcpp/codecompass:web-sqlite --file docker/web/Dockerfile --no-cache .
417- docker build -t codecompass:runtime -t modelcpp/codecompass:runtime-pgsql --file docker/runtime/Dockerfile --no-cache --build-arg CC_DATABASE=pgsql .
418- docker build -t codecompass:web -t modelcpp/codecompass:web-pgsql --file docker/web/Dockerfile --no-cache .
419- docker tag modelcpp/codecompass:runtime-pgsql modelcpp/codecompass:latest
426+ export BRANCH=${{ steps.branch_substring.outputs.substring }}
427+ docker build -t codecompass$BRANCH:dev -t modelcpp/codecompass$BRANCH:dev --file docker/dev/Dockerfile .
428+ docker build -t codecompass$BRANCH:runtime -t modelcpp/codecompass$BRANCH:runtime-sqlite --file docker/runtime/Dockerfile --no-cache --build-arg CC_DATABASE=sqlite .
429+ docker build -t codecompass$BRANCH:web -t modelcpp/codecompass$BRANCH:web-sqlite --file docker/web/Dockerfile --no-cache .
430+ docker build -t codecompass$BRANCH:runtime -t modelcpp/codecompass$BRANCH:runtime-pgsql --file docker/runtime/Dockerfile --no-cache --build-arg CC_DATABASE=pgsql .
431+ docker build -t codecompass$BRANCH:web -t modelcpp/codecompass$BRANCH:web-pgsql --file docker/web/Dockerfile --no-cache .
432+ docker tag modelcpp/codecompass$BRANCH:runtime-pgsql modelcpp/codecompass$BRANCH:latest
420433
421434 - name : Login to DockerHub
422435 uses : docker/login-action@v1
@@ -425,17 +438,19 @@ jobs:
425438 password : ${{ secrets.DOCKER_PASSWORD }}
426439
427440 - name : Push images
441+ if : ${{ github.ref_name == 'master' || startsWith(github.ref_name, 'release') == true }}
428442 run : |
429- docker push modelcpp/codecompass:dev
430- docker push modelcpp/codecompass:runtime-sqlite
431- docker push modelcpp/codecompass:runtime-pgsql
432- docker push modelcpp/codecompass:web-sqlite
433- docker push modelcpp/codecompass:web-pgsql
434- docker push modelcpp/codecompass:latest
443+ export BRANCH=${{ steps.branch_substring.outputs.substring }}
444+ docker push modelcpp/codecompass$BRANCH:dev
445+ docker push modelcpp/codecompass$BRANCH:runtime-sqlite
446+ docker push modelcpp/codecompass$BRANCH:runtime-pgsql
447+ docker push modelcpp/codecompass$BRANCH:web-sqlite
448+ docker push modelcpp/codecompass$BRANCH:web-pgsql
449+ docker push modelcpp/codecompass$BRANCH:latest
435450
436451 tarball :
437452 needs : parse
438- if : ${{ github.repository == 'Ericsson/CodeCompass' && github.ref == 'refs/heads/ master' }}
453+ if : ${{ github.repository == 'Ericsson/CodeCompass' && github.ref_name == 'master' }}
439454 runs-on : ubuntu-20.04
440455
441456 steps :
@@ -445,5 +460,5 @@ jobs:
445460 - name : Install curl
446461 run : sudo apt-get install curl
447462
448- - name : Trigget GitLab CI
449- run : curl -X POST -F token=${{ secrets.GITLAB_TRIGGER_TOKEN }} -F ref=master https://gitlab.inf.elte.hu/api/v4/projects/85/trigger/pipeline
463+ - name : Trigger GitLab CI
464+ run : curl -X POST -F token=${{ secrets.GITLAB_TRIGGER_TOKEN }} -F ref=${{ github.ref_name }} https://gitlab.inf.elte.hu/api/v4/projects/85/trigger/pipeline
0 commit comments