Skip to content

Commit

Permalink
feat: add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
yanhaijing committed May 1, 2024
1 parent a8a0ae8 commit 50b8996
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/check-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
node-version: ${{ matrix.node-version }} # 使用不同的 Node.js 版本

- name: Create new JS project
run: echo js-project | npx @js-lib/cli new --npmname js-project --umdname js-project --username yanhaijing --type js --lang en --manager npm
run: echo js-project | npx @js-lib/cli new --npmname js-project --umdname js-project --username yanhaijing --type js --manager npm

- name: Run lint in JS project
working-directory: ./js-project
Expand All @@ -35,7 +35,7 @@ jobs:

- name: Update JS project
working-directory: ./js-project
run: jslib update
run: npx @js-lib/cli update

test-jslib-ts:
name: Test jslib with TS projects
Expand All @@ -52,7 +52,7 @@ jobs:
node-version: ${{ matrix.node-version }} # 使用不同的 Node.js 版本

- name: Create new TS project
run: echo ts-project | npx @js-lib/cli new --npmname ts-project --umdname ts-project --username yanhaijing --type ts --lang en --manager npm
run: echo ts-project | npx @js-lib/cli new --npmname ts-project --umdname ts-project --username yanhaijing --type ts --manager npm

- name: Run lint in JS project
working-directory: ./ts-project
Expand All @@ -68,4 +68,4 @@ jobs:

- name: Update JS project
working-directory: ./ts-project
run: jslib update
run: npx @js-lib/cli update
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:

- name: Create new JS project
working-directory: ../
run: echo js-project | jslib new --npmname js-project --umdname js-project --username yanhaijing --type js --lang en --manager npm
run: echo js-project | jslib new --npmname js-project --umdname js-project --username yanhaijing --type js --manager npm

- name: Run lint in JS project
working-directory: ../js-project
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:

- name: Create new TS project
working-directory: ../
run: echo ts-project | jslib new --npmname ts-project --umdname ts-project --username yanhaijing --type ts --lang en --manager npm
run: echo ts-project | jslib new --npmname ts-project --umdname ts-project --username yanhaijing --type ts --manager npm

- name: Run lint in TS project
working-directory: ../ts-project
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish npm Package

on:
workflow_dispatch:
inputs:
release_type:
description: 'Type of release'
required: true
default: 'stable'
options:
- stable
- alpha

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install jslib globally
run: yarn install

- name: Publish to npm
working-directory: packages/cli
run: |
if [[ "${{ github.event.inputs.release_type }}" == "stable" ]]; then
npm publish
else
npm publish --tag next
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 50b8996

Please sign in to comment.