name: Build and push Docker images

on:
  push:
    tags:        
      - v**
        
jobs:

  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    
    - name: Get tag
      id: tag
      uses: dawidd6/action-get-tag@v1
      with:
        strip_v: true 
        
    - name: Login to Docker Hub
      uses: docker/login-action@v1
      with:
        username: ${{ secrets.DOCKER_HUB_USERNAME }}
        password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

    - name: Build and push
      uses: docker/build-push-action@v3
      with:
        push: true
        tags: illuspas/node-media-server:latest, illuspas/node-media-server:${{steps.tag.outputs.tag}}
