From a46e75225ecfb1a9c00e4bbacd62641f23da0581 Mon Sep 17 00:00:00 2001
From: jianridine <70822647+jianridine@users.noreply.github.com>
Date: Sat, 12 Dec 2020 19:26:52 -0800
Subject: [PATCH] Create publish_docker_images.yml

---
 .github/workflows/publish_docker_images.yml | 41 +++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 .github/workflows/publish_docker_images.yml

diff --git a/.github/workflows/publish_docker_images.yml b/.github/workflows/publish_docker_images.yml
new file mode 100644
index 0000000..20bb84c
--- /dev/null
+++ b/.github/workflows/publish_docker_images.yml
@@ -0,0 +1,41 @@
+name: Publish Dockerfile on DockerHub
+on: 
+  push: 
+    branches:
+      - main
+    paths: 
+      - 'Dockerfile'
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@master
+      with:
+        fetch-depth: '0'
+    - name: Bump version and push tag
+      uses: anothrNick/github-tag-action@1.33.0
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        WITH_V: true
+        RELEASE_BRANCHES: main
+      id: bump
+    - name: Create Release
+      id: create_release
+      uses: actions/create-release@v1
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
+      with:
+        tag_name: ${{ steps.bump.outputs.new_tag }}
+        release_name: ${{ steps.bump.outputs.new_tag }}
+        body: |
+          Changes in this Release
+          - Rebuilt Docker image and published to DockerHub with new tag
+        draft: false
+        prerelease: false
+    - name: Publish to Registry
+      uses: elgohr/Publish-Docker-Github-Action@master
+      with:
+        name: vigneshrajakumar/wine_predictor # change this to your DockerHub username and repository
+        username: ${{ secrets.DOCKER_USERNAME }} # you need to add your Docker username to this GitHub repo as a secret
+        password: ${{ secrets.DOCKER_PASSWORD }} # you need to add your Docker password to this GitHub repo as a secret
+        tags: "latest,${{ steps.bump.outputs.new_tag }}"