Skip to content

Commit ebdb02a

Browse files
committed
Add workflow
1 parent 8e4abd8 commit ebdb02a

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/jsonata.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build and publish JSONata
2+
on:
3+
push:
4+
branches: [ master, v1 ]
5+
pull_request:
6+
branches: [ master, v1 ]
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version: [12.x, 14.x, 16.x, 18.x]
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
- name: Use Node.js ${{ matrix.node-version }}
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: ${{ matrix.node-version }}
20+
- run: npm install
21+
- run: npm test
22+
publish:
23+
needs: build
24+
runs-on: ubuntu-latest
25+
if: ${{ github.event_name == 'push' && github.repository == 'jsonata-js/jsonata' }}
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
- name: Use Node.js 18.x
30+
uses: actions/setup-node@v3
31+
with:
32+
node-version: 18.x
33+
- name: Install and build
34+
run: npm install && npm test
35+
- name: Publish to NPM
36+
id: npmpub
37+
uses: JS-DevTools/npm-publish@v1
38+
with:
39+
token: ${{ secrets.NPM_TOKEN }}
40+
- if: steps.npmpub.outputs.type != 'none'
41+
run: |
42+
echo "Version changed: ${{ steps.npmpub.outputs.old-version }} => ${{ steps.npmpub.outputs.version }}"
43+
documentation:
44+
needs: build
45+
runs-on: ubuntu-latest
46+
if: ${{ github.event_name == 'push' && github.repository == 'jsonata-js/jsonata' }}
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v3
50+
- name: Use Node.js 18.x
51+
uses: actions/setup-node@v3
52+
with:
53+
node-version: 18.x
54+
- name: Build documentation
55+
run: |
56+
cd website
57+
npm install
58+
npm run build
59+
- name: Deploy to GitHub Pages
60+
if: success()
61+
run: |
62+
cd website
63+
git config --global user.name "andrew-coleman"
64+
git config --global user.email "[email protected]"
65+
echo "machine github.com login andrew-coleman password ${{ secrets.DOCS_AUTH }}" > ~/.netrc
66+
npm run publish-gh-pages
67+
env:
68+
GIT_USER: andrew-coleman

0 commit comments

Comments
 (0)