Skip to content

3.0.3

3.0.3 #6

# publish to dockerhub action
name: Publish to Dockerhub
defaults:
run:
working-directory: ./nodejs-docker
on:
release:
types: [published]
jobs:
push-to-dockerhub:
runs-on: ubuntu-latest
steps:
- name: Get Code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: vaibhavsinghal87/learn-github-actions
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and Publish
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}