Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
tanbowensg committed Jul 29, 2024
1 parent 6336987 commit dcd2ba8
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "CI Check"

on:
pull_request:
branches: ["main"]

# Cancel prev CI if new commit come
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: [self-hosted, linux]
strategy:
matrix:
node: [16]
name: Run Test on Node ${{ matrix.node }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Setup yarn
run: npm install -g yarn
- name: Install deps
run: yarn install --frozen-lockfile
timeout-minutes: 15
- name: Go to refine
run: cd packages/refine
- name: Test
run: yarn jest
- name: Build
run: yarn build
48 changes: 48 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: publish

on:
push:
tags:
- "*"

jobs:
publish:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: [self-hosted, linux]
strategy:
matrix:
node: [16]
name: Publish on Node ${{ matrix.node }}
steps:
- name: checkout
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Setup yarn
run: npm install -g yarn
- name: Install deps
run: yarn install --frozen-lockfile
timeout-minutes: 15
- name: Go to refine
run: cd packages/refine
- name: Build
run: yarn build
- name: Write .npmrc
env:
NPM_TOKEN: ${{ secrets.MY_NPM_TOKEN }}
run: |
echo //registry.npmjs.org/:_authToken=$NPM_TOKEN > ~/.npmrc
- name: Publish
uses: nick-fields/retry@v2
with:
timeout_minutes: 10 # 设置超时时间,单位为分钟
max_attempts: 3 # 设置最大重试次数
command: |
npm publish
- name: sync cnpm
run: curl --location --request PUT 'http://192.168.26.29:7002/sync/@dovetail-v2/refine?sync_upstream=true'
- name: Clean .npmrc
if: always()
run: rm ~/.npmrc

0 comments on commit dcd2ba8

Please sign in to comment.