Skip to content

Commit 9d62055

Browse files
committed
fix: add publish to npm on release
1 parent 21a7fe8 commit 9d62055

File tree

1 file changed

+17
-42
lines changed

1 file changed

+17
-42
lines changed

.github/workflows/test.yml

+17-42
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,28 @@
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
3-
4-
name: Matrix Testing
5-
1+
name: Publish package to NPM
62
on:
7-
# push:
8-
# branches:
9-
# - main
10-
# - sandbox
11-
# - dev
12-
13-
pull_request:
14-
branches:
15-
- main
16-
- sandbox
17-
- dev
3+
release:
4+
types: [created]
185

196
jobs:
20-
deploy:
7+
build:
8+
name: Publish to NPM
219
runs-on: ubuntu-latest
22-
strategy:
23-
matrix:
24-
node: ["16", "17"]
25-
name: Node ${{ matrix.node }} sample
2610
steps:
27-
- name: Checkout
11+
- name: Check out code from repository
2812
uses: actions/checkout@v2
29-
30-
- uses: actions/setup-node@v2
3113
with:
32-
node-version: ${{ matrix.node }}
33-
34-
# - name: Cache dependencies
35-
# id: cache-modules
36-
# uses: actions/cache@v2
37-
# with:
38-
# path: ~/.npm
39-
# key: npm-${{ hashFiles('package-lock.json') }}
40-
# restore-keys: npm-
41-
42-
- name: NPM Install
43-
# if: steps.cache-modules.outputs.cache-hit != 'true'
44-
run: |
45-
npm install
14+
ref: main
4615

47-
- name: Run svelte-check
16+
- name: Set Current Version
4817
run: |
49-
npm run svelte-check
18+
CURRENT_VERSION=${{ github.event.release.tag_name }}
19+
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
20+
echo ${{ env.CURRENT_VERSION }}
5021
51-
- name: Run jest
22+
- name: Build and Publish
5223
run: |
53-
npm run test
24+
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
25+
npm i --no-save
26+
lerna publish ${{ env.CURRENT_VERSION }} --force-publish --no-git-tag-version --yes
27+
env:
28+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)