Skip to content

Commit

Permalink
📝 Chore(CI/CD): Now can auto release when pushed with tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dynesshely committed Mar 12, 2023
1 parent 413533d commit 09bb070
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@

name: 部署文档
name: Build, Deploy and Release

on:
push:
branches:
# 确保这是你正在使用的分支名称
- main

jobs:
deploy-gh-pages:
runs-on: ubuntu-latest
# if: "contains(github.event.head_commit.message, '[Deploy]')"
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -19,27 +16,14 @@ jobs:
# 如果你文档需要 Git 子模块,取消注释下一行
# submodules: true

# - name: 设置 Node.js
# uses: actions/setup-node@v3
# with:
# node-version: 18
# # cache: pnpm

- name: 设置 Yarn
- name: Setup Yarn
# You may pin to the exact commit or the version.
# uses: DerYeger/yarn-setup-action@f55be5383ea94f5eb25b20aee609af4603a68dde
uses: DerYeger/yarn-setup-action@v1.0.1
with:
# The version of Node.js that will be used
node-version: 18

# - name: 安装 pnpm
# uses: pnpm/action-setup@v2
# with:
# version: 7
# run_install: true

- name: 构建文档
- name: Build Docs
env:
NODE_OPTIONS: --max_old_space_size=8192
run: |-
Expand All @@ -48,9 +32,24 @@ jobs:
echo "do not need it" > docs/.vuepress/dist/.nojekyll
cd ..
- name: 部署文档
- name: Deploy Docs
uses: JamesIves/github-pages-deploy-action@v4
with:
# 这是文档部署到的分支名称
# Branch where docs deploy to
branch: gh-pages
folder: docs/.vuepress/dist

- name: Zip Build
run: zip -r docs.zip ./docs/.vuepress/dist

- name: Create Release and Upload Release Asset
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref }}
body: Auto release by Actions.
draft: false
prerelease: false
files: |
docs.zip

0 comments on commit 09bb070

Please sign in to comment.