diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 41f312fa..8ea25def 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,4 +1,4 @@ -name: Node.js CI +name: Build and publish JSONata on: push: @@ -16,12 +16,57 @@ jobs: node-version: [12.x, 14.x, 16.x] steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - run: npm install - run: npm test - - \ No newline at end of file + publish: + needs: build + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' && github.repository == 'andrew-coleman/jsonata' }} +# if: ${{ github.event_name == 'push' && github.repository == 'jsonata-js/jsonata' }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Use Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: 16.x + registry-url: 'https://registry.npmjs.org' + - name: Install and build + run: npm install && npm test + - name: Publish to NPM + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + documentation: + needs: build + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' && github.repository == 'andrew-coleman/jsonata' }} +# if: ${{ github.event_name == 'push' && github.repository == 'jsonata-js/jsonata' }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Use Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: 16.x + - name: Build documentation + run: | + cd website + npm install + npm run build + - name: Deploy to GitHub Pages + if: success() + run: | + cd website + git config --global user.name "andrew-coleman" + git config --global user.email "andrew_coleman@uk.ibm.com" + echo "machine github.com login ${GIT_USER} password ${{ secrets.GITHUB_TOKEN }}" > ~/.netrc + npm run publish-gh-pages + env: + GIT_USER: andrew-coleman diff --git a/src/jsonata.js b/src/jsonata.js index 8b4a68ca..ce52096c 100644 --- a/src/jsonata.js +++ b/src/jsonata.js @@ -112,7 +112,7 @@ var jsonata = (function() { case 'transform': result = evaluateTransformExpression(expr, input, environment); break; - } + } if (Object.prototype.hasOwnProperty.call(expr, 'predicate')) { for(var ii = 0; ii < expr.predicate.length; ii++) {