Skip to content

Commit

Permalink
Ensure Action env is always a string for comparisons in Docker image …
Browse files Browse the repository at this point in the history
…builds

The env was likely interpreted as `'false'`, which is truthy in JS. As a result,
instead of the `:development` tag a `:main` and `:latest` tag were build and
pushed.
  • Loading branch information
tomudding committed Jun 23, 2024
1 parent 3f26bcc commit 4b10386
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:
cancel-in-progress: true

env:
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/') }}
IS_RELEASE: ${{ format('{0}', startsWith(github.ref, 'refs/tags/')) }}

jobs:
build:
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
context: ${{ matrix.image == 'web' && '.' || format('./docker/{0}', matrix.image) }}
file: ${{ matrix.image == 'web' && (env.IS_RELEASE && './docker/web/production/Dockerfile' || './docker/web/development/Dockerfile') || format('./docker/{0}/Dockerfile', matrix.image) }}
file: ${{ matrix.image == 'web' && (env.IS_RELEASE == 'true' && './docker/web/production/Dockerfile' || './docker/web/development/Dockerfile') || format('./docker/{0}/Dockerfile', matrix.image) }}
platforms: linux/amd64
push: true
tags: ${{ format('{0}:{1}', format('{0}/web/gewisweb/{1}', vars.ABC_DOCKER_REGISTRY, matrix.image), env.IS_RELEASE && format('{0},{1}:latest', github.ref_name, format('{0}/web/gewisweb/{1}', vars.ABC_DOCKER_REGISTRY, matrix.image)) || 'development') }}
tags: ${{ format('{0}:{1}', format('{0}/web/gewisweb/{1}', vars.ABC_DOCKER_REGISTRY, matrix.image), env.IS_RELEASE == 'true' && format('{0},{1}:latest', github.ref_name, format('{0}/web/gewisweb/{1}', vars.ABC_DOCKER_REGISTRY, matrix.image)) || 'development') }}

0 comments on commit 4b10386

Please sign in to comment.