Skip to content

Commit 12aa003

Browse files
authored
Merge pull request #31 from mmdapl/master
feat(ci): update yaml
2 parents a6737ad + 6c5b40f commit 12aa003

File tree

5 files changed

+79
-88
lines changed

5 files changed

+79
-88
lines changed

.github/workflows/deploy-esc.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/workflows/docker-image.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
11
# 构建Docker镜像
22
name: Docker-Image
33

4+
## 触发条件
45
on:
5-
push: # 推送的时候触发
6-
branches: [ "master" , "next" ] # 推送的分支
6+
push:
7+
branches:
8+
- master
9+
- next
710
# Publish semver tags as releases.
811
# tags: [ 'v*.*.*' ]
912
# 手动触发部署
1013
workflow_dispatch:
1114
pull_request:
12-
branches: [ "master" , "next" ]
15+
branches:
16+
- master
17+
- next
1318

19+
## 环境变量
1420
env:
15-
# 仓库地址
1621
REGISTRY: registry.cn-hangzhou.aliyuncs.com
1722
UserName: mmdapl
1823

19-
2024
jobs:
2125
Docker-Image:
2226
name: "构建Docker镜像"
2327
runs-on: ubuntu-latest
2428
if: github.repository == '142vip/JavaScriptCollection'
2529
permissions:
26-
contents: read
27-
packages: write
28-
# This is used to complete the identity challenge
29-
# with sigstore/fulcio when running outside of PRs.
30-
id-token: write
30+
actions: read
31+
pull-requests: read
3132

3233
steps:
3334
- name: Checkout repository
3435
uses: actions/checkout@v3
3536

3637
- name: Login Docker
3738
run: |
38-
docker version &&
39-
docker login --username=${{ env.UserName }} --password=${{ secrets.Docker_Password }} ${{env.REGISTRY}}
39+
docker version
40+
echo "-----------Docker Login-----------"
41+
docker login --username=${{ env.UserName }} --password=${{ secrets.DOCKER_PASSWORD }} ${{env.REGISTRY}}
4042
4143
- name: PNPM Install
4244
uses: pnpm/action-setup@v2
4345
with:
4446
version: 7
4547
node-version: 14.20.1
4648
run_install: true
47-
49+
# 缓存 pnpm 依赖
50+
cache: pnpm
4851
- name: Build And Push Docker image
49-
run:
50-
PROXY_DOMAIN=true pnpm faster-image
52+
run: PROXY_DOMAIN=true pnpm faster-image

.github/workflows/esc-deploy.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# 部署到服务器
2+
name: Deploy-ESC
3+
4+
on:
5+
push: # 推送的时候触发
6+
branches:
7+
- master
8+
workflow_dispatch:
9+
10+
env:
11+
REGISTRY: registry.cn-hangzhou.aliyuncs.com
12+
UserName: mmdapl
13+
14+
15+
jobs:
16+
Deploy-ESC:
17+
name: "部署到ESC"
18+
runs-on: ubuntu-latest
19+
if: github.repository == '142vip/JavaScriptCollection'
20+
permissions:
21+
actions: read
22+
pull-requests: read
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v3
27+
28+
- name: Get Current Version
29+
id: version
30+
uses: ashley-taylor/read-json-property-action@v1.0
31+
with:
32+
path: ./package.json
33+
property: version
34+
35+
# 拉取镜像,更新服务
36+
- name: Pull Image And Update ESC
37+
uses: appleboy/ssh-action@master
38+
with:
39+
host: ${{ secrets.SERVER_HOST }}
40+
port: ${{ secrets.SERVER_PORT }}
41+
username: ${{ secrets.SERVER_USERNAME }}
42+
password: ${{ secrets.SERVER_PASSWORD }}
43+
script: |
44+
docker images
45+
echo "-----------正在运行的服务--------"
46+
docker ps
47+
cd /service_env/ && git reset --hard && git pull origin main
48+
bash ./scripts/book_doc.deploy.sh jsc ${{steps.version.outputs.value}}
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
name: docs-page-deploy
2-
1+
## 参考资料:https://v2.vuepress.vuejs.org/zh/guide/deployment.html#github-pages
2+
name: gh-deploy
33
on:
4-
# 每当 push 到 next 分支时触发部署
54
push:
6-
branches: ["next"]
7-
# 手动触发部署
5+
branches:
6+
- next
87
workflow_dispatch:
98

109
jobs:
11-
docs:
10+
deploy-github:
11+
name: "部署到Github"
1212
runs-on: ubuntu-latest
1313

1414
steps:
@@ -17,15 +17,13 @@ jobs:
1717
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
1818
fetch-depth: 0
1919

20-
- name: Setup pnpm
20+
- name: Setup PNPM
2121
uses: pnpm/action-setup@v2
2222
with:
23-
# 选择要使用的 pnpm 版本
2423
version: 7
25-
# 使用 pnpm 安装依赖
2624
run_install: true
2725

28-
- name: Setup Node.js
26+
- name: Setup Node Version
2927
uses: actions/setup-node@v3
3028
with:
3129
# 选择要使用的 node 版本
@@ -34,18 +32,14 @@ jobs:
3432
cache: pnpm
3533

3634
# 运行构建脚本
37-
- name: Build VuePress site
38-
run: pnpm build-proxy
35+
- name: Build VuePress Site
36+
run:
37+
PROXY_DOMAIN=true pnpm build
3938

40-
# 查看 workflow 的文档来获取更多信息
41-
# @see https://github.com/crazy-max/ghaction-github-pages
42-
- name: Deploy to GitHub Pages
39+
- name: Deploy to GitHub Page
4340
uses: crazy-max/ghaction-github-pages@v2
4441
with:
45-
# 部署到 gh-pages 分支
4642
target_branch: pages/github
47-
# 部署目录为 VuePress 的默认输出目录
4843
build_dir: docs/.vuepress/dist
4944
env:
50-
# @see https://docs.github.com/cn/actions/reference/authentication-in-a-workflow#about-the-github_token-secret
5145
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
# GitHub Action

0 commit comments

Comments
 (0)