Skip to content

1588 accidental unpacking during evaluating the if statement (#1601) #94

1588 accidental unpacking during evaluating the if statement (#1601)

1588 accidental unpacking during evaluating the if statement (#1601) #94

Workflow file for this run

name: Publish to npm
on:
push:
branches:
- master
jobs:
verify:
name: Verify should publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: master
submodules: recursive
- name: Verify version has changed
# We use jq as `npm pkg get version` returns a quoted string
run: |
if [ "$(cat package.json | jq -r .version)" == "$(npm view js-slang version)" ]; then
echo "Version has not changed"
echo "UPDATE=false" >> "$GITHUB_OUTPUT"
else
echo "Version has changed";
echo "UPDATE=true" >> "$GITHUB_OUTPUT"
fi
publish:
name: Publish to npm
needs: [verify]
if: ${{ needs.verify.outputs.UPDATE == 'true' }}
environment: publish-npm # Await approval from maintainers
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: master
submodules: recursive
- name: Install dependencies (apt)
run: |
sudo apt-get update && \
sudo apt-get install -y --no-install-recommends libxi-dev libgl1-mesa-dev
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}