|
1 | 1 | name: Node.js Package |
2 | 2 |
|
3 | 3 | on: |
4 | | - release: |
5 | | - types: [created] |
| 4 | + release: |
| 5 | + types: [created] |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - build-and-publish: |
9 | | - name: Build and Publish to NPM Registry |
10 | | - |
11 | | - runs-on: ubuntu-latest |
12 | | - |
13 | | - steps: |
14 | | - - name: Checkout repository |
15 | | - uses: actions/checkout@v4 |
16 | | - |
17 | | - - name: Use Node.js |
18 | | - uses: actions/setup-node@v4 |
19 | | - with: |
20 | | - node-version-file: '.nvmrc' |
21 | | - cache: 'npm' |
22 | | - registry-url: 'https://registry.npmjs.org/' |
23 | | - |
24 | | - - name: Install dependencies |
25 | | - run: npm ci |
26 | | - |
27 | | - - name: Execute test cases |
28 | | - run: npm test |
29 | | - |
30 | | - - name: Build Lib |
31 | | - run: npm run build-lib |
32 | | - |
33 | | - - name: Publish to NPM Registry |
34 | | - run: npm publish --access public |
35 | | - env: |
36 | | - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 8 | + build-and-publish: |
| 9 | + name: Build and Publish to NPM Registry |
| 10 | + |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout repository |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Use Node.js |
| 18 | + uses: actions/setup-node@v4 |
| 19 | + with: |
| 20 | + node-version-file: '.nvmrc' |
| 21 | + cache: 'npm' |
| 22 | + registry-url: 'https://registry.npmjs.org/' |
| 23 | + |
| 24 | + - name: Install dependencies |
| 25 | + run: npm ci |
| 26 | + |
| 27 | + - name: Execute test cases |
| 28 | + run: npm test |
| 29 | + |
| 30 | + - name: Build Lib |
| 31 | + run: npm run build-lib |
| 32 | + |
| 33 | + - name: Publish to NPM Registry |
| 34 | + run: | |
| 35 | + VERSION=$(node -p "require('./package.json').version") |
| 36 | + |
| 37 | + if [[ $VERSION == *"-beta."* ]]; then |
| 38 | + npm publish --access public --tag beta |
| 39 | +
|
| 40 | + elif [[ $VERSION == *"-"* ]]; then |
| 41 | + npm publish --access public --tag next |
| 42 | +
|
| 43 | + else |
| 44 | + npm publish --access public |
| 45 | + fi |
| 46 | + env: |
| 47 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
0 commit comments