|
1 |
| -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node |
2 |
| -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions |
| 1 | +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created |
| 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages |
3 | 3 |
|
4 |
| -name: Node.js CI |
| 4 | +name: test and publish |
5 | 5 |
|
6 | 6 | on:
|
7 | 7 | push:
|
8 |
| - branches: [master] |
| 8 | + branches: [master, main] |
9 | 9 | pull_request:
|
10 |
| - branches: [master] |
11 | 10 |
|
12 | 11 | # Allows you to run this workflow manually from the Actions tab
|
13 | 12 | workflow_dispatch:
|
14 | 13 |
|
15 | 14 | jobs:
|
16 | 15 | build:
|
17 | 16 | runs-on: ubuntu-latest
|
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + - uses: actions/setup-node@v4 |
| 20 | + with: |
| 21 | + node-version: lts/* |
| 22 | + - run: yarn install |
| 23 | + - run: yarn typescript |
| 24 | + - run: yarn prettier:check |
| 25 | + - run: yarn lint |
| 26 | + - run: yarn test |
| 27 | + - run: yarn build |
18 | 28 |
|
19 |
| - strategy: |
20 |
| - matrix: |
21 |
| - node-version: [18.x] |
22 |
| - |
| 29 | + publish-npm: |
| 30 | + needs: build |
| 31 | + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' |
| 32 | + runs-on: ubuntu-latest |
23 | 33 | steps:
|
24 |
| - - uses: actions/checkout@v2 |
25 |
| - - name: Use Node.js ${{ matrix.node-version }} |
26 |
| - uses: actions/setup-node@v1 |
| 34 | + - name: Create Release Pull Request or Publish |
| 35 | + id: changesets |
| 36 | + uses: changesets/action@v1 |
27 | 37 | with:
|
28 |
| - node-version: ${{ matrix.node-version }} |
29 |
| - - run: yarn install --frozen-lockfile |
30 |
| - - run: yarn lint && yarn typescript |
| 38 | + publish: yarn run release-packages |
31 | 39 | env:
|
32 |
| - CI: true |
33 |
| -# release: |
34 |
| -# runs-on: ubuntu-latest |
35 |
| -# if: github.ref == 'refs/heads/master' |
36 |
| -# steps: |
37 |
| -# - uses: actions/checkout@v2 |
38 |
| -# with: |
39 |
| -# fetch-depth: 0 |
40 |
| -# - name: git config |
41 |
| -# run: | |
42 |
| -# git config user.name "${GITHUB_ACTOR}" |
43 |
| -# git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" |
44 |
| -# - run: | |
45 |
| -# echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc |
46 |
| -# npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN |
47 |
| -# env: |
48 |
| -# NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
49 |
| -# - run: yarn install --frozen-lockfile |
50 |
| -# - run: yarn prepare && yarn release |
51 |
| -# env: |
52 |
| -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN_NEW }} |
0 commit comments