Skip to content

Commit 76b241b

Browse files
committed
Update test trigger condition
1 parent d13a9ea commit 76b241b

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.github/workflows/publish.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Publish to npm
22
on:
3-
push:
4-
tags:
5-
- v[0-9].[0-9]+.[0-9]+
3+
release:
4+
types: [published]
65
jobs:
76
publish:
87
runs-on: ubuntu-latest
@@ -13,12 +12,14 @@ jobs:
1312
node-version: 12
1413
- name: Check tag version
1514
run: |
15+
TAG_NAME=${{ github.event.release.tag_name }}
1616
VERSION=$(node -e 'console.info(require("./package.json").version)')
17-
if [ "refs/tags/v${VERSION}" != $GITHUB_REF ]; then
18-
echo "Ref ${GITHUB_REF} not match"
17+
if [ "v${VERSION}" != $TAG_NAME ]; then
18+
echo "Ref ${TAG_NAME} not match with v${VERSION}"
1919
exit 1
2020
fi
2121
- run: npm install
22-
- run: npm publish
23-
env:
24-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
22+
- name: publish
23+
run: |
24+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
25+
npm publish

.github/workflows/test.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
name: Run tests
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches:
5+
- '*'
6+
pull_request:
7+
branches:
8+
- '*'
39
jobs:
410
test:
511
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)