-
Notifications
You must be signed in to change notification settings - Fork 7
68 lines (63 loc) · 1.86 KB
/
deploy-docker.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
name: Deploy VitePress site to Docker
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
version: 9.11.0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: pnpm install
- name: Build with VitePress
run: pnpm build
- name: Push Image
env:
DOCKER_USERNAME: ${{ secrets.CODING_USER }}
DOCKER_PASSWORD: ${{ secrets.CODING_PASS }}
DOCKER_REGISTRY: ${{ secrets.CODING_SERVER }}
SHA: ${{ github.sha }}
run: |
docker build . -t doc-v3:latest
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY
docker tag doc-v3:latest $DOCKER_REGISTRY/mineadmin/mineadmin/doc-v3:$SHA
docker push $DOCKER_REGISTRY/mineadmin/mineadmin/doc-v3:$SHA
# 部署工作
deploy:
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Build Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
script: |
export CODING_SERVER=${{ secrets.CODING_SERVER }}
export SHA=${{ github.sha }}
export CODING_USER=${{ secrets.CODING_USER }}
export CODING_PASS=${{ secrets.CODING_PASS }}
sh /opt/www/deploy-doc-v3.sh