-
Notifications
You must be signed in to change notification settings - Fork 4
75 lines (59 loc) · 2.11 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Docker Image CI
on:
push:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Github Repo
uses: actions/checkout@v4
with:
# submodules: recursive
submodules: 'true'
token: ${{ secrets.CHECKOUT_REPO_TOKEN }}
- name: Set Branch Name
run: echo "BRANCH_NAME=$(echo $GITHUB_REF | sed 's/refs\/heads\///')" >> $GITHUB_ENV
- name: Set Timestamp
run: echo "TIMESTAMP=$(date +%s%3N)" >> $GITHUB_ENV
- name: Fetch default.conf
uses: valitydev/action-download-file@v1
with:
url: https://raw.githubusercontent.com/lcxfs1991/docschina-deployment/main/stencil/default.conf
target-path: .
- name: Fetch Dockerfile
uses: valitydev/action-download-file@v1
with:
url: https://raw.githubusercontent.com/lcxfs1991/docschina-deployment/main/stencil/Dockerfile
target-path: .
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 14
- name: Build docs
run: |
npm i
npm run build
- name: Docker build
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ccr.ccs.tencentyun.com
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64
tags: ccr.ccs.tencentyun.com/docschina/stencil:${{ env.BRANCH_NAME }}-${{ env.TIMESTAMP }}
- name: Deployment
uses: TencentCloud/cli-action@v1
with:
secret_id: ${{ secrets.SECRET_ID }}
secret_key: ${{ secrets.SECRET_KEY }}
region: ${{ secrets.LIGHTHOUSE_REGION }}
commands: tat InvokeCommand --cli-unfold-argument --region ap-shanghai --CommandId cmd-boc4aaiw --InstanceIds lhins-nkwfootc --Parameters '{"deployment":"stencil","image":"ccr.ccs.tencentyun.com/docschina/stencil:${{ env.BRANCH_NAME }}-${{ env.TIMESTAMP }}"}'
output_format: json