Skip to content

Commit 2c0abd7

Browse files
publish step to be triggered by new version tag (#796) (#819)
Signed-off-by: Andrew Coleman <andrew_coleman@uk.ibm.com>
1 parent fa1d57f commit 2c0abd7

2 files changed

Lines changed: 27 additions & 22 deletions

File tree

.github/workflows/jsonata.yml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and publish JSONata
1+
name: Build JSONata
22
on:
33
push:
44
branches: [ master, v1 ]
@@ -19,27 +19,6 @@ jobs:
1919
node-version: ${{ matrix.node-version }}
2020
- run: npm install
2121
- 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 }}"
4322
documentation:
4423
needs: build
4524
runs-on: ubuntu-latest

.github/workflows/publish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Publish JSONata
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
id-token: write # Required for OIDC
10+
contents: read
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v6
17+
18+
- uses: actions/setup-node@v6
19+
with:
20+
node-version: '24'
21+
registry-url: 'https://registry.npmjs.org'
22+
package-manager-cache: false # never use caching in release builds
23+
- name: Install and build
24+
run: npm install && npm test
25+
- name: Publish to NPM
26+
run: npm publish

0 commit comments

Comments
 (0)