Skip to content

Commit 3237d51

Browse files
committed
Add Docker image deploy on tag
Signed-off-by: m09 <[email protected]>
1 parent 1553043 commit 3237d51

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/cd.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
deploy:
10+
name: Deploy to Docker Hub
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Build and tag Docker image
14+
run: >-
15+
export TAG=${${{ github.ref }}##*/}
16+
echo Building for tag "$TAG"
17+
docker build -t $IMG_NAME:$TAG .
18+
docker tag $IMG_NAME:$TAG $IMG_NAME:latest
19+
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_LOGIN }}" --password-stdin
20+
docker push $IMG_NAME
21+
env:
22+
- IMG_NAME: mloncode/workshop

0 commit comments

Comments
 (0)