Skip to content

Commit bb6fb43

Browse files
author
微信公众号:储凡
authored
feat(gh-pages): 丰富pages站点的提交信息,实时同步next分支内容 (#83)
1 parent bf3a025 commit bb6fb43

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

.github/workflows/CD.yaml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,28 @@ jobs:
5959
run: |
6060
./scripts/bundle build_proxy
6161
62-
## 部署到Github Pages
62+
- name: Check GitHub Pages status
63+
uses: crazy-max/ghaction-github-status@v3
64+
with:
65+
pages_threshold: major_outage
66+
67+
## 获取Git提交信息
68+
- name: Get Commit Info
69+
id: gitInfo
70+
run: |
71+
echo "commitMessage=$(git log -1 --pretty=%B)" >> $GITHUB_OUTPUT
72+
echo "author=$(git log -1 --pretty=%an)" >> $GITHUB_OUTPUT
73+
echo "email=$(git log -1 --pretty=%ae)" >> $GITHUB_OUTPUT
74+
75+
## 参考:https://github.com/marketplace/actions/github-pages
6376
- name: Deploy To GitHub Page
6477
uses: crazy-max/ghaction-github-pages@v3
6578
with:
6679
target_branch: pages/github
6780
build_dir: docs/.vuepress/dist
81+
commit_message: ${{steps.gitInfo.outputs.commitMessage}}
82+
committer: ${{steps.gitInfo.outputs.author}}<${{steps.gitInfo.outputs.email}}>
83+
author: Mr·Sync
6884
env:
6985
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7086

@@ -121,20 +137,21 @@ jobs:
121137
122138
# 提取版本号
123139
- name: Get New Version Number
124-
id: extract_version
125-
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"
140+
id: releaseVersion
141+
run: |
142+
echo "::set-output name=version::$(node -p "require('./package.json').version")"
126143
127144
# 创建发布版本
128145
- name: Create New Release
129-
id: create_release
146+
id: createRelease
130147
uses: actions/create-release@latest
131148
env:
132149
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133150
with:
134-
tag_name: v${{ steps.extract_version.outputs.version }}
135-
release_name: v${{ steps.extract_version.outputs.version }}
151+
tag_name: v${{ steps.releaseVersion.outputs.version }}
152+
release_name: v${{ steps.releaseVersion.outputs.version }}
136153
body: |
137-
Release ${{ steps.extract_version.outputs.version }}
154+
Release ${{ steps.releaseVersion.outputs.version }}
138155
139156
### Features
140157
@@ -146,7 +163,7 @@ jobs:
146163
env:
147164
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148165
with:
149-
upload_url: ${{ steps.create_release.outputs.upload_url }}
166+
upload_url: ${{ steps.createRelease.outputs.upload_url }}
150167
asset_path: ./JavaScriptCollection.zip
151168
asset_name: JavaScriptCollection.zip
152169
asset_content_type: application/zip

0 commit comments

Comments
 (0)