Skip to content

Commit 80b0432

Browse files
authored
prevent pre-releases from triggering image build
1 parent de54b68 commit 80b0432

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/build-and-push-images.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,22 @@ jobs:
4343
- name: Extract version from tag
4444
id: extract-version
4545
run: |
46-
echo "version=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
46+
VERSION="${GITHUB_REF_NAME#v}"
47+
48+
TAGS="investbrainapp/investbrain:${VERSION},ghcr.io/investbrainapp/investbrain:${VERSION}"
49+
50+
# Conditionally add 'latest' tags unless 'pre-release' is in the version
51+
if [[ "${GITHUB_REF_NAME}" != *alpha* && "${GITHUB_REF_NAME}" != *beta* && "${GITHUB_REF_NAME}" != *rc* ]]; then
52+
TAGS="$TAGS,investbrainapp/investbrain:latest,ghcr.io/investbrainapp/investbrain:latest"
53+
fi
54+
55+
echo "tags=$TAGS" >> $GITHUB_OUTPUT
4756

4857
- name: Build and push
4958
uses: docker/build-push-action@v6
5059
with:
5160
platforms: linux/amd64,linux/arm64
5261
file: ./docker/Dockerfile
5362
push: true
54-
tags: |
55-
investbrainapp/investbrain:latest
56-
investbrainapp/investbrain:${{ env.version }}
57-
ghcr.io/investbrainapp/investbrain:latest
58-
ghcr.io/investbrainapp/investbrain:${{ env.version }}
63+
tags: ${{ steps.extract-version.outputs.tags }}
64+

0 commit comments

Comments
 (0)