From bc248f0a3e2c3dbd132d02a74f77706e3f2f5087 Mon Sep 17 00:00:00 2001 From: d-telnyx <68876596+d-telnyx@users.noreply.github.com> Date: Tue, 16 Mar 2021 13:40:28 -0400 Subject: [PATCH] Auto NPM publish Publish to NPM on release mint --- .github/workflows/npm-publish.yml | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/npm-publish.yml diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..1082d1e --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,53 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages + +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12 + - run: npm ci + test: + runs-on: ubuntu-latest + env: + TELNYX_MOCK_VERSION: 0.8.10 + strategy: + matrix: + node-version: [8.x, 10.x, 12.x, 14.x] + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: setup-telnyx-mock + run: source ./.github/scripts/before_install.sh + - run: npm ci + - run: npm run build --if-present + - name: Node ${{ matrix.node-version }} + run: npm test + - name: Report + run: npm run report + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_CI_TOKEN}