-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: support create tag and release on ci
- Loading branch information
Showing
1 changed file
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,10 +20,13 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
# 签出分支 | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
- uses: actions/checkout@v4 | ||
|
||
# 设置 git | ||
- name: Setup git | ||
run: | | ||
git config --local user.email [email protected] | ||
git config --local user.name AidenFEBot | ||
# 获取tag版本 | ||
# - name: Get the version | ||
|
@@ -56,23 +59,51 @@ jobs: | |
SKIP_INSTALL_SIMPLE_GIT_HOOKS: 1 | ||
SKIP_SIMPLE_GIT_HOOKS: 1 | ||
run: | | ||
pnpm install | ||
pnpm install --frozen-lockfile | ||
# 同步版本及推送标签 | ||
- name: Bump version and push tag | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# 更新npm版本 | ||
- name: Updated version | ||
run: | | ||
npm pkg set version=${{ steps.tag_version.outputs.new_version }} | ||
git add -A | ||
git commit -m "chore: published tag ${{ steps.tag_version.outputs.new_tag }}" | ||
# 构建项目 | ||
- name: Run build | ||
env: | ||
NODE_ENV: production | ||
NODE_OPTIONS: --max_old_space_size=8192 | ||
run: | | ||
pnpm build | ||
pnpm build:doc | ||
# 创建Github release | ||
- name: Create a GitHub release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
|
||
# 发布npm包 | ||
- name: Publish | ||
uses: JS-DevTools/npm-publish@v3 | ||
with: | ||
token: ${{ secrets.NPM_AUTH_TOKEN }} | ||
|
||
# 推送变更至仓库 | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.ref }} | ||
|
||
# 部署文档 | ||
- name: Deploy GitHub Pages site | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
|