Skip to content

Commit 8188fc0

Browse files
committed
fix: update Docker image tags and add version extraction from package.json
1 parent 26ac4a5 commit 8188fc0

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,26 @@ jobs:
3434
with:
3535
node-version: 24
3636
registry-url: https://registry.npmjs.org/
37-
3837
- run: git config --global user.email "elabutin@mts.ru"
3938
- run: git config --global user.name "Eugene Labutin"
4039
- run: npm ci
4140
- run: npm run release
4241
- run: git push && git push --tags
4342

43+
- name: Get version from package.json
44+
run: |
45+
VERSION=$(node -p "require('./package.json').version")
46+
echo "VERSION=$VERSION" >> $GITHUB_ENV
47+
echo "MAJOR=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_ENV
48+
echo "MINOR=$(echo $VERSION | cut -d. -f2)" >> $GITHUB_ENV
49+
echo "PATCH=$(echo $VERSION | cut -d. -f3)" >> $GITHUB_ENV
50+
4451
- name: Build and push Docker image
4552
uses: docker/build-push-action@v3
4653
with:
4754
push: true
48-
tags: mtsrus/logs:latest, mtsrus/logs:1, mtsrus/logs:1.1, mtsrus/logs:1.1.5
55+
tags: |
56+
mtsrus/logs:latest
57+
mtsrus/logs:${{ env.MAJOR }}
58+
mtsrus/logs:${{ env.MAJOR }}.${{ env.MINOR }}
59+
mtsrus/logs:${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}

0 commit comments

Comments
 (0)