publish #42
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
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] # 当push代码到main分支时会自动触发action | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest # GitHub分配的运行平台,无需更改 | |
steps: | |
- uses: actions/checkout@v2 # 使用action库 actions/checkout获取源码,执行你的操作 | |
with: | |
persist-credentials: false | |
ref: main | |
submodules: true | |
# 设置npm配置 | |
- name: Set npm configuration | |
run: | | |
npm config set registry https://registry.npmjs.org/ | |
# 安装依赖 | |
- name: Install Dependencies | |
run: npm i | |
# 打包 | |
- name: Build | |
run: npm run build | |
# 创建dist目录并复制.vitepress/dist内容到dist目录下 | |
- name: Copy .vitepress/dist to dist | |
run: | | |
mkdir -p dist | |
cp -r .vitepress/dist/* dist/ | |
# 安装lusun-scripts | |
- name: Install lusun-scripts | |
run: npm i -g lusun-scripts | |
# 使用lusun-scripts部署到阿里云OSS | |
- name: Deploy to OSS | |
env: | |
ACCESS_KEY_ID: ${{ secrets.ACCESSKEYID }} | |
ACCESS_KEY_SECRET: ${{ secrets.ACCESSKEYSECRET }} | |
FEISHU_ID: ${{ secrets.FEISHU_ID }} | |
FEISHU_SERCET: ${{ secrets.FEISHU_SERCET }} | |
run: | | |
lusun-scripts deploy \ | |
--accessKeyId $ACCESS_KEY_ID \ | |
--accessKeySecret $ACCESS_KEY_SECRET \ | |
--directoryPath tcq \ | |
--bucket docs-lusun-web \ | |
--endpoint oss-cn-beijing.aliyuncs.com |