Skip to content

Merge branch 'main' of github.com:MobileTeleSystems/image-optimize #63

Merge branch 'main' of github.com:MobileTeleSystems/image-optimize

Merge branch 'main' of github.com:MobileTeleSystems/image-optimize #63

name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Log into registry docker.io
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and publish package
uses: actions/setup-node@v3
with:
node-version: 24
registry-url: https://registry.npmjs.org/
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "Eugene Labutin"
- run: npm ci
- run: npm run release
- run: git push && git push --tags
- name: Get version from package.json
run: |
VERSION=$(node -p "require('./package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "MAJOR=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_ENV
echo "MINOR=$(echo $VERSION | cut -d. -f2)" >> $GITHUB_ENV
echo "PATCH=$(echo $VERSION | cut -d. -f3)" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
push: true
tags: |
mtsrus/image-optimize:latest
mtsrus/image-optimize:${{ env.MAJOR }}
mtsrus/image-optimize:${{ env.MAJOR }}.${{ env.MINOR }}
mtsrus/image-optimize:${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}