From 49b6d0f5bacd4b272c0c39071082119df20a52b0 Mon Sep 17 00:00:00 2001 From: Yen Truong <36055303+yen-tt@users.noreply.github.com> Date: Tue, 8 Jun 2021 16:09:40 -0400 Subject: [PATCH] automate npm publish (#1427) * 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 --- .github/workflows/npm_publish.yml | 31 +++++++++++++++++++++++++++++++ .npmignore | 2 -- package.json | 3 +++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/npm_publish.yml delete mode 100644 .npmignore diff --git a/.github/workflows/npm_publish.yml b/.github/workflows/npm_publish.yml new file mode 100644 index 000000000..2f5bc5a7d --- /dev/null +++ b/.github/workflows/npm_publish.yml @@ -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}} diff --git a/.npmignore b/.npmignore deleted file mode 100644 index ef5ccfd3b..000000000 --- a/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -**/.DS_Store diff --git a/package.json b/package.json index fa7e2a182..483ec990f 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,9 @@ "javascript", "vanilla" ], + "files": [ + "dist" + ], "dependencies": { "@mapbox/mapbox-gl-language": "^0.10.1", "@yext/answers-core": "^1.2.0-alpha.0",