Skip to content

feat: enhance timestamp and UUID handling in Adminizer migration #176

feat: enhance timestamp and UUID handling in Adminizer migration

feat: enhance timestamp and UUID handling in Adminizer migration #176

Workflow file for this run

name: Publish Package to npmjs
on:
push:
branches:
- next
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v3
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
- run: npm i --force && npm run build
- run: cp ./package.json ./dist && cp ./Readme.md ./dist/ && echo '//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}' > ./dist/.npmrc
# resolve version
- run: |
set -x
BRANCH=${GITHUB_REF##*/}
PACKAGE=$(cat package.json | jq -r '.["name"]')
VERLOC=$(cat package.json | jq -r '.["version"]')
VERNPMRAW=$(curl -s https://registry.npmjs.org/$PACKAGE | jq -r '.["dist-tags"].'$BRANCH'')
BUILD_VERSION=0
if [[ "$VERNPMRAW" == "null" ]]; then
VEROUT=$VERLOC
else
VERNPM=$(echo $VERNPMRAW | cut -d'-' -f1)
BUILD_VERSION=$(echo $VERNPMRAW | awk -F '[.-]' '{print $5+1}')
VEROUT=$(printf "$VERNPM\n$VERLOC\n" | sort -V -r | awk 'NR==1 {print; exit}')
fi
jq -r '.version = "'${VEROUT}'-build.'$BUILD_VERSION'"' package.json > /tmp/package.json && mv /tmp/package.json ./package.json
working-directory: ./dist
- run: npm publish --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: ./dist