Skip to content

Commit e269f4a

Browse files
author
dannysteinbrecher
committed
fix: streamline Docker image tagging process in CI pipeline
1 parent d78a598 commit e269f4a

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

.github/workflows/frontend-build-and-push.yaml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,11 @@ jobs:
8282
run: |
8383
cd frontend
8484
npm run semantic-release
85-
86-
# If semantic release created a new version, tag and push the Docker image with semantic version
87-
- name: Tag and push semantic version
88-
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && steps.semantic.outcome == 'success'
89-
run: |
90-
cd frontend
91-
# Get the version from package.json after semantic-release
9285
NEW_VERSION=$(node -p "require('./package.json').version")
86+
FRONTEND_VERSION="frontend-v$NEW_VERSION"
9387
94-
if [ -n "$NEW_VERSION" ] && [ "$NEW_VERSION" != "null" ]; then
95-
echo "Semantic release created version: $NEW_VERSION"
96-
# Create frontend-prefixed version tag
97-
FRONTEND_VERSION="frontend-v$NEW_VERSION"
98-
echo "Creating release tag: $FRONTEND_VERSION"
99-
100-
# Tag the existing image with the frontend-prefixed semantic version
101-
docker pull ${{ env.FRONTEND_IMAGE }}:${{ env.SHORT_SHA }}
102-
docker tag ${{ env.FRONTEND_IMAGE }}:${{ env.SHORT_SHA }} ${{ env.FRONTEND_IMAGE }}:$FRONTEND_VERSION
103-
docker push ${{ env.FRONTEND_IMAGE }}:$FRONTEND_VERSION
104-
echo "Tagged and pushed image with frontend version: $FRONTEND_VERSION"
105-
else
106-
echo "No new version was created by semantic-release"
107-
fi
88+
# Tag the existing image with the frontend-prefixed semantic version
89+
docker pull ${{ env.FRONTEND_IMAGE }}:${{ env.SHORT_SHA }}
90+
docker tag ${{ env.FRONTEND_IMAGE }}:${{ env.SHORT_SHA }} ${{ env.FRONTEND_IMAGE }}:$FRONTEND_VERSION
91+
docker push ${{ env.FRONTEND_IMAGE }}:$FRONTEND_VERSION
92+
echo "Tagged and pushed image with frontend version: $FRONTEND_VERSION"

0 commit comments

Comments
 (0)