Skip to content

Publish Docker Image #7

Publish Docker Image

Publish Docker Image #7

name: Publish Docker Image
on:
workflow_dispatch:
workflow_run:
workflows: ["Publish Node.js Package"]
types: [completed]
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_TOKEN}}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 22
- name: Update package version
run: |
cd ./docker
npm i shevchenko@latest
- name: Check in the changes
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git add .
git commit -m "chore(docker): bump package version"
git push origin
- name: Retrieve the release version
id: npm-version
uses: martinbeentjes/npm-get-version-action@v1.3.1
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: ./docker
push: true
tags: ${{secrets.DOCKERHUB_USERNAME}}/shevchenko:latest,${{secrets.DOCKERHUB_USERNAME}}/shevchenko:${{steps.npm-version.outputs.current-version}}