Skip to content

Commit

Permalink
Update test trigger condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ngs committed Jun 2, 2020
1 parent d13a9ea commit 76b241b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Publish to npm
on:
push:
tags:
- v[0-9].[0-9]+.[0-9]+
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -13,12 +12,14 @@ jobs:
node-version: 12
- name: Check tag version
run: |
TAG_NAME=${{ github.event.release.tag_name }}
VERSION=$(node -e 'console.info(require("./package.json").version)')
if [ "refs/tags/v${VERSION}" != $GITHUB_REF ]; then
echo "Ref ${GITHUB_REF} not match"
if [ "v${VERSION}" != $TAG_NAME ]; then
echo "Ref ${TAG_NAME} not match with v${VERSION}"
exit 1
fi
- run: npm install
- run: npm publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: publish
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm publish
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Run tests
on: [push, pull_request]
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
test:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 76b241b

Please sign in to comment.