diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 85da952..55d933c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -7,12 +7,32 @@ on: branches: [ master ] jobs: - - build: - + docker: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) + - name: Checkout + uses: actions/checkout@v3 + + #- name: Build the Docker image + # run: docker build . --file Dockerfile --tag dell_idrac_fan_controller:$(date +%s) + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: tigerblue77/dell_idrac_fan_controller + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}