Skip to content

Commit e7e33f5

Browse files
author
Chu Fan
committed
feat: update ci yaml
1 parent 5bd6c5d commit e7e33f5

File tree

4 files changed

+41
-51
lines changed

4 files changed

+41
-51
lines changed

.github/workflows/docker-image.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,51 @@
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
37-
run: |
38-
docker version &&
39-
docker login --username=${{ env.UserName }} --password=${{ secrets.Docker_Password }} ${{env.REGISTRY}}
38+
- run: docker version
39+
- run: echo "-----------Docker Login-----------"
40+
- run: docker login --username=${{ env.UserName }} --password=${{ secrets.Docker_Password }} ${{env.REGISTRY}}
4041

4142
- name: PNPM Install
4243
uses: pnpm/action-setup@v2
4344
with:
4445
version: 7
4546
node-version: 14.20.1
4647
run_install: true
47-
48+
# 缓存 pnpm 依赖
49+
cache: pnpm
4850
- name: Build And Push Docker image
49-
run:
50-
PROXY_DOMAIN=true pnpm faster-image
51+
- run: PROXY_DOMAIN=true pnpm faster-image
Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@ name: Deploy-ESC
33

44
on:
55
push: # 推送的时候触发
6-
branches: [ "master" ] # 推送的分支
7-
# Publish semver tags as releases.
8-
# tags: [ 'v*.*.*' ]
9-
# 手动触发部署
6+
branches:
7+
- master
108
workflow_dispatch:
11-
# pull_request:
12-
# branches: [ "next" ]
139

1410
env:
15-
# 仓库地址
1611
REGISTRY: registry.cn-hangzhou.aliyuncs.com
1712
UserName: mmdapl
1813

@@ -23,22 +18,20 @@ jobs:
2318
runs-on: ubuntu-latest
2419
if: github.repository == '142vip/JavaScriptCollection'
2520
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
21+
actions: read
22+
pull-requests: read
3123

3224
steps:
3325
- name: Checkout repository
3426
uses: actions/checkout@v3
3527

36-
- name: 读取当前版本号
28+
- name: Get Current Version
3729
id: version
3830
uses: ashley-taylor/read-json-property-action@v1.0
3931
with:
4032
path: ./package.json
4133
property: version
34+
4235
# 拉取镜像,更新服务
4336
- name: Pull Image And Update ESC
4437
uses: appleboy/ssh-action@master
@@ -48,8 +41,8 @@ jobs:
4841
username: ${{ secrets.Server_UserName }}
4942
password: ${{ secrets.Server_Password }}
5043
script: |
51-
docker images &&
52-
echo "-----------正在运行的服务--------" &&
53-
docker ps &&
54-
cd //service_env/ && git reset --hard && git pull origin main &&
44+
docker images
45+
echo "-----------正在运行的服务--------"
46+
docker ps
47+
cd /service_env/ && git reset --hard && git pull origin main
5548
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)