Skip to content

Merge pull request #299 from equinor/sefo/feat/add-npm-publish-wf #621

Merge pull request #299 from equinor/sefo/feat/add-npm-publish-wf

Merge pull request #299 from equinor/sefo/feat/add-npm-publish-wf #621

Workflow file for this run

name: Node CI
on:
push:
branches: [dev]
pull_request:
branches: [dev]
types: closed
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
npm ci
npm run build --if-present
npm test
npm run lint
env:
CI: true
- name: Compare versions
id: compare
shell: bash
run: |
PKG_VERSION="$(npm search videx-wellog -json true | jq .[].version -r)"
echo "Online version: $PKG_VERSION"
LOCAL_VERSION="$(cat package.json | jq .version -r)"
if ! printf "$LOCAL_VERSION\n$PKG_VERSION" | sort -V -C; then BUMP='true'; else BUMP='false'; fi;
echo $BUMP >> $GITHUB_OUTPUT
- name: Publish
if: ${{steps.compare.outputs.BUMP == 'true'}} && github.event.pull_request.merged = true
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
run: |
npm publish