From 3237d5153895ed84e94e43881234553d65a13883 Mon Sep 17 00:00:00 2001 From: m09 <142691+m09@users.noreply.github.com> Date: Mon, 27 Jan 2020 13:48:21 +0100 Subject: [PATCH] Add Docker image deploy on tag Signed-off-by: m09 <142691+m09@users.noreply.github.com> --- .github/workflows/cd.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..2fcfcbd --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,22 @@ +name: CD + +on: + push: + tags: + - "*" + +jobs: + deploy: + name: Deploy to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Build and tag Docker image + run: >- + export TAG=${${{ github.ref }}##*/} + echo Building for tag "$TAG" + docker build -t $IMG_NAME:$TAG . + docker tag $IMG_NAME:$TAG $IMG_NAME:latest + echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_LOGIN }}" --password-stdin + docker push $IMG_NAME + env: + - IMG_NAME: mloncode/workshop