mirror of
https://git.bjxgj.com/xgj/xgj-actions.git
synced 2025-10-14 17:13:38 +08:00
feat: 添加 npm 依赖安装与缓存的 GitHub Action,支持多种包管理器,优化 CI/CD 流程,提供详细的缓存状态和安装总结。
This commit is contained in:
35
npm-install/examples/basic-npm.yml
Normal file
35
npm-install/examples/basic-npm.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
# 基础npm项目示例
|
||||
name: 基础npm项目CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 检出代码
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: 设置Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
|
||||
- name: 安装依赖
|
||||
uses: actions/xgj/npm-install@v1
|
||||
# 使用默认配置:npm包管理器,不强制安装,不启用git stash
|
||||
|
||||
- name: 运行linting
|
||||
run: npm run lint
|
||||
|
||||
- name: 运行测试
|
||||
run: npm test
|
||||
|
||||
- name: 构建项目
|
||||
run: npm run build
|
Reference in New Issue
Block a user