feat: 优化 CLI 工具的输出文件处理逻辑 #21
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: CI | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**/*.ts' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
STORE_PATH=$(pnpm store path --silent) | |
echo "STORE_PATH=$STORE_PATH" >> $GITHUB_ENV | |
echo "pnpm store path: $STORE_PATH" | |
- name: Setup pnpm cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: | | |
pnpm install --no-frozen-lockfile || (echo "Dependency installation failed" && exit 1) | |
- name: Check format | |
run: | | |
pnpm format:check || echo "Format check failed" | |
- name: Run lint | |
run: | | |
pnpm lint || echo "Linting issues detected" | |
- name: Build | |
run: | | |
pnpm build || (echo "Build failed" && exit 1) | |
- name: Test | |
run: | | |
pnpm test || (echo "Test failed" && exit 1) | |
- name: Commit and Push | |
run: | | |
git add README-zh.md | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git config advice.ignoredHook false | |
git commit -m "docs(README): update README-zh.md" | |
git push origin main || echo "Push to repository failed" | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
if: success() |