# This workflow will build a Node project with Docker

name: build and push docker image

on:
    release:
        types: [published]
    workflow_dispatch:

jobs:
    build-node:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v2
            - name: Set up Docker Buildx
              id: buildx
              uses: docker/setup-buildx-action@v1
            - name: Login to DockerHub
              if: ${{ github.ref == 'refs/heads/master' }}
              uses: docker/login-action@v1
              with:
                  username: ${{ secrets.DOCKERHUB_USERNAME }}
                  password: ${{ secrets.DOCKERHUB_TOKEN }}
            - name: Build and push Docker images
              uses: docker/build-push-action@v2.9.0
              with:
                  github-token: ${{ github.token }}
                  push: ${{ github.ref == 'refs/heads/master' }}
                  tags: |
                      "multidl/multi-downloader-nx:latest"
            - name: Image digest
              run: echo ${{ steps.docker_build.outputs.digest }}
