优化安装教程 #16
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
name: build | |
on: | |
push: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest] | |
steps: | |
- name: 拉取项目代码 | |
uses: actions/checkout@v3 | |
- name: 安装node环境 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "19" | |
- name: 安装pnpm | |
uses: pnpm/action-setup@v2 | |
id: pnpm-install | |
with: | |
version: "8.3.1" | |
run_install: false | |
- name: 获取pnpm仓库目录 | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: 设置pnpm缓存 | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: 安装Python3环境 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
cache: "pip" | |
- name: 初始化打包环境 | |
run: pnpm run init | |
- name: 开始打包 | |
run: pnpm run build | |
- name: 上传打包完成的程序包 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Setup | |
retention-days: 1 | |
path: build/*-*_*.* |