Skip to content

Update license

Update license #60

Workflow file for this run

name: Publish to npm
on:
push:
branches:
- main
- next
- beta
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm ci
- name: Get branch name and commit hash
id: git-info
run: |
echo "BRANCH_NAME=${GITHUB_REF_NAME}" >> $GITHUB_ENV
COMMIT_HASH=$(git rev-parse --short HEAD)
echo "COMMIT_HASH=${COMMIT_HASH}" >> $GITHUB_ENV
- name: Conditional Version Update
if: startsWith(env.BRANCH_NAME, 'next') || startsWith(env.BRANCH_NAME, 'beta')
run: |
TAG_NAME=${{ env.BRANCH_NAME }}
COMMIT_HASH=${{ env.COMMIT_HASH }}
lerna list --json | jq -r '.[] | .location' | while read -r package; do
CURRENT_VERSION=$(jq -r '.version' $package/package.json)
NEW_VERSION="${CURRENT_VERSION}-${TAG_NAME}.${COMMIT_HASH}"
jq ".version = \"${NEW_VERSION}\"" $package/package.json > $package/package.json.tmp && mv $package/package.json.tmp $package/package.json
done
- name: Assume unchanged for all package.json files
run: |
git ls-files -m | grep 'package.json' | xargs -I {} git update-index --assume-unchanged {}
- name: Publish packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [[ "${GITHUB_REF##*/}" == "main" ]]; then
DIST_TAG="latest"
else
DIST_TAG="${GITHUB_REF##*/}"
fi
npx lerna publish from-package --yes --dist-tag $DIST_TAG