Skip to content

Commit b4b7fd5

Browse files
committed
fix: ci
1 parent 4d72d09 commit b4b7fd5

File tree

1 file changed

+18
-28
lines changed

1 file changed

+18
-28
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- master
77

8+
env:
9+
TKE_DOCKER_HUB: ccr.ccs.tencentyun.com
10+
TKE_IMAGE_URL: ccr.ccs.tencentyun.com/hejunwei/machine-manage-api
11+
812
jobs:
913
build:
1014
runs-on: ubuntu-latest
@@ -16,31 +20,17 @@ jobs:
1620
- name: Change env.lua
1721
run: cp env.example.json env.json
1822

19-
- name: Build and push
20-
uses: mr-smithers-excellent/docker-build-push@v5
21-
with:
22-
image: horan/lua-china
23-
registry: docker.io
24-
tags: $GITHUB_SHA
25-
username: horan
26-
password: ${{ secrets.DOCKERHUB_TOKEN }}
27-
28-
deploy:
29-
runs-on: ubuntu-latest
30-
name: Deploy docker
31-
needs: build
32-
steps:
33-
- name: ssh pipelines
34-
uses: cross-the-world/ssh-pipeline@master
35-
env:
36-
WELCOME: "ssh pipeline"
37-
with:
38-
host: 115.28.82.133
39-
user: root
40-
pass: ${{ secrets.SSH_PASSWORD }}
41-
port: 22
42-
connect_timeout: 10s
43-
script: |
44-
(docker pull horan/lua-china:$GITHUB_SHA) &&
45-
(docker rm -f lua-china || true) &&
46-
docker run -p 10.31.231.178:8888:80 --name=lua-china -d horan/lua-china:$GITHUB_SHA
23+
- name: Export Date Env
24+
id: CURRENT_DATE
25+
run: echo "::set-output name=date::$(TZ=Asia/Shanghai date +'%Y-%m-%d-%H-%M-%S')"
26+
27+
- name: Build the Docker image
28+
run: docker build -t ${TKE_IMAGE_URL}:${{steps.CURRENT_DATE.outputs.date}} .
29+
30+
- name: Login TKE Registry
31+
run: |
32+
docker login ${TKE_DOCKER_HUB} --username="${{secrets.TENCENT_CLOUD_ACCOUNT_ID}}" -p "${{ secrets.TKE_REGISTRY_PASSWORD }}"
33+
34+
- name: Push docker image
35+
run: |
36+
docker push ${TKE_IMAGE_URL}:${{steps.CURRENT_DATE.outputs.date}}

0 commit comments

Comments
 (0)