Release v2.12.0 #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tag latest npm packages | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to run the workflow on' | |
required: true | |
default: 'main' | |
release: | |
types: | |
- released | |
jobs: | |
tag-latest: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
- name: Get list of packages | |
run: | | |
npx lerna list --json > pckg-list.json | |
- name: Tag latest npm packages | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc | |
PACKAGE_DATA=$(cat pckg-list.json) | |
PACKAGE_COUNT=$(echo "$PACKAGE_DATA" | jq length) | |
for i in $(seq 0 $(($PACKAGE_COUNT-1))); do | |
PACKAGE=$(echo "$PACKAGE_DATA" | jq -r ".[$i].name") | |
VERSION=$(echo "$PACKAGE_DATA" | jq -r ".[$i].version") | |
npm dist-tag add "$PACKAGE@$VERSION" latest | |
done |