Skip to content

Commit

Permalink
automate npm publish (#1427)
Browse files Browse the repository at this point in the history
* automate npm publish

GH workflow action which, on successful build from master branch, will publish dist/ to npm registry

J=SLAP-1353
TEST=manual

created mock repo and npm package, made a new tagged release and verified it automatically publish to npm test package.

Co-authored-by: Yen Truong <ytruong@yext.com>
  • Loading branch information
yen-tt and Yen Truong committed Jun 8, 2021
1 parent f2c7eb9 commit 49b6d0f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/npm_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: NPM publish on new release

on:
release:
types: [created]
branches:
- master

jobs:
npm-publish:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [15.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm run prepublishOnly
- run: npm publish
- run: npm run postpublish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
2 changes: 0 additions & 2 deletions .npmignore

This file was deleted.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"javascript",
"vanilla"
],
"files": [
"dist"
],
"dependencies": {
"@mapbox/mapbox-gl-language": "^0.10.1",
"@yext/answers-core": "^1.2.0-alpha.0",
Expand Down

0 comments on commit 49b6d0f

Please sign in to comment.