Skip to content

Merge pull request #1 from JOU-amjs/feature-1.0.x #2

Merge pull request #1 from JOU-amjs/feature-1.0.x

Merge pull request #1 from JOU-amjs/feature-1.0.x #2

Workflow file for this run

name: build
# 触发条件:在 push或合并请求 到 master 或 release开头的分支后
on:
push:
branches:
- main
- alpha
- beta
pull_request:
branches: '*'
# 任务
jobs:
quality:
# 服务器环境:最新版 Ubuntu
runs-on: ubuntu-latest
steps:
# 拉取代码
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.12.x
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
# 执行测试和打包操作
- name: Install deps
run: npm ci
- name: Lint check
run: npm run lint
# 这条命令包含了测试
- name: Unit tests
if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/alpha' && github.ref != 'refs/heads/beta' }}
run: npm run test
release:
runs-on: ubuntu-latest
needs: [quality]
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta' }}
steps:
# 拉取代码
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.12.x
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
# 执行测试和打包操作
- name: Install deps
run: npm ci
- name: Test SSR
run: npm run test:node
# 这条命令包含了测试和上传覆盖率
- name: Coverage
run: npm run coveralls
- name: Release
run: npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ALOVA_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.ALOVA_GITHUB_TOKEN }}