Skip to content

Commit

Permalink
Move release name to Docker tag instead of image name.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcserep committed Jan 25, 2022
1 parent deb9c8b commit 52327cd
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ jobs:
docker:
needs: parse
if: ${{ github.repository == 'Ericsson/CodeCompass' && (github.ref_name == 'master' || startsWith(github.ref_name, 'release') == true) }}
if: ${{ github.repository == 'Ericsson/CodeCompass' && (github.ref_name == 'master' || startsWith(github.ref_name, 'release/') == true) }}
runs-on: ubuntu-20.04

steps:
Expand All @@ -416,20 +416,19 @@ jobs:
id: branch_substring
with:
value: ${{ env.GITHUB_REF_SLUG }}
index_of_str: "release"
index_of_str: "release-"
fail_if_not_found: false
default_return_value: ""

- name: Build images
if: ${{ github.ref_name == 'master' || startsWith(github.ref_name, 'release') == true }}
run: |
export BRANCH=${{ steps.branch_substring.outputs.substring }}
docker build -t codecompass:dev -t modelcpp/codecompass$BRANCH:dev --file docker/dev/Dockerfile .
docker build -t codecompass:runtime -t modelcpp/codecompass$BRANCH:runtime-sqlite --file docker/runtime/Dockerfile --no-cache --build-arg CC_DATABASE=sqlite .
docker build -t codecompass:web -t modelcpp/codecompass$BRANCH:web-sqlite --file docker/web/Dockerfile --no-cache .
docker build -t codecompass:runtime -t modelcpp/codecompass$BRANCH:runtime-pgsql --file docker/runtime/Dockerfile --no-cache --build-arg CC_DATABASE=pgsql .
docker build -t codecompass:web -t modelcpp/codecompass$BRANCH:web-pgsql --file docker/web/Dockerfile --no-cache .
docker tag modelcpp/codecompass$BRANCH:runtime-pgsql modelcpp/codecompass$BRANCH:latest
BRANCH_PREFIX=${{ steps.branch_substring.outputs.substring }}
BRANCH_PREFIX=${BRANCH_PREFIX}${BRANCH_PREFIX:+-} # append dash if not empty
docker build -t codecompass:dev -t modelcpp/codecompass:${BRANCH_PREFIX}dev --file docker/dev/Dockerfile .
docker build -t codecompass:runtime -t modelcpp/codecompass:${BRANCH_PREFIX}runtime-sqlite --file docker/runtime/Dockerfile --no-cache --build-arg CC_DATABASE=sqlite .
docker build -t codecompass:web -t modelcpp/codecompass:${BRANCH_PREFIX}web-sqlite --file docker/web/Dockerfile --no-cache .
docker build -t codecompass:runtime -t modelcpp/codecompass:${BRANCH_PREFIX}runtime-pgsql --file docker/runtime/Dockerfile --no-cache --build-arg CC_DATABASE=pgsql .
docker build -t codecompass:web -t modelcpp/codecompass:${BRANCH_PREFIX}web-pgsql --file docker/web/Dockerfile --no-cache .
- name: Login to DockerHub
uses: docker/login-action@v1
Expand All @@ -438,19 +437,24 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push images
if: ${{ github.ref_name == 'master' || startsWith(github.ref_name, 'release') == true }}
run: |
export BRANCH=${{ steps.branch_substring.outputs.substring }}
docker push modelcpp/codecompass$BRANCH:dev
docker push modelcpp/codecompass$BRANCH:runtime-sqlite
docker push modelcpp/codecompass$BRANCH:runtime-pgsql
docker push modelcpp/codecompass$BRANCH:web-sqlite
docker push modelcpp/codecompass$BRANCH:web-pgsql
docker push modelcpp/codecompass$BRANCH:latest
BRANCH_PREFIX=${{ steps.branch_substring.outputs.substring }}
BRANCH_PREFIX=${BRANCH_PREFIX}${BRANCH_PREFIX:+-} # append dash if not empty
docker push modelcpp/codecompass:${BRANCH_PREFIX}dev
docker push modelcpp/codecompass:${BRANCH_PREFIX}runtime-sqlite
docker push modelcpp/codecompass:${BRANCH_PREFIX}runtime-pgsql
docker push modelcpp/codecompass:${BRANCH_PREFIX}web-sqlite
docker push modelcpp/codecompass:${BRANCH_PREFIX}web-pgsql
- name: Tag and push latest image
if: ${{ github.ref_name == 'master' }}
run: |
docker tag modelcpp/codecompass:runtime-pgsql modelcpp/codecompass:latest
docker push modelcpp/codecompass:latest
tarball:
needs: parse
if: ${{ github.repository == 'Ericsson/CodeCompass' && (github.ref_name == 'master' || startsWith(github.ref_name, 'release') == true) }}
if: ${{ github.repository == 'Ericsson/CodeCompass' && (github.ref_name == 'master' || startsWith(github.ref_name, 'release/') == true) }}
runs-on: ubuntu-20.04

steps:
Expand Down

0 comments on commit 52327cd

Please sign in to comment.