Merge pull request #1 from kwooshung/develop #1
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 | |
# 当推送到 main分支 时 触发此工作流 | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@main | |
# 全局安装 pnpm | |
- name: install pnpm | |
run: npm install -g pnpm | |
# 使用 pnpm 安装依赖 | |
- name: install dependencies | |
run: pnpm install | |
# 使用 pnpm 执行测试 | |
- name: run tests | |
run: pnpm test:ci | |
# 上传覆盖率报告到 Coveralls | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@main | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
# 使用 pnpm 构建 | |
- name: build | |
run: pnpm build | |
# 自动发布 | |
- name: Auto Release | |
run: npx cvlar -r | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# 同步到 Gitee | |
- name: Sync to Gitee | |
uses: wearerequired/git-mirror-action@master | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.GITEE_PRIVATE_KEY }} | |
with: | |
source-repo: '[email protected]:kwooshung/files.git' | |
destination-repo: '[email protected]:kwooshung/files.git' | |
# 自动发布到 npm | |
- name: Sync to Npm.js | |
uses: actions/setup-node@main | |
with: | |
node-version: '14.0.0' | |
registry-url: https://registry.npmjs.org/ | |
- name: Publish to Npm.js | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |