Skip to content

0.2.17

0.2.17 #9

Workflow file for this run

name: Publish to npm
on:
push:
tags:
- 'v*.*.*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
scope: '@patternize'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: Publish to npm
run: |
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > .npmrc
yarn publish --non-interactive || {
if grep -q "You cannot publish over the previously published versions" <<< "$(cat /home/runner/.npm/_logs/*-debug-0.log)"; then
echo "Version already exists on npm - treating as success"
exit 0
else
exit 1
fi
}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}