Skip to content

Prune NPM tags

Prune NPM tags #239

Workflow file for this run

name: Prune NPM tags
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
prune:
if: false
name: Prune NPM tags
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: 'latest'
- name: Setup .npmrc file
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
- name: Prune sdk tags
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
npm view $PACKAGE_NAME dist-tags --json | jq -r 'to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "next") | .key' | xargs -I % npm dist-tag rm $PACKAGE_NAME %
working-directory: packages/core
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deprecate canary versions
working-directory: packages/core
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
TWO_DAYS_AGO=$(date --date='2 days ago' +%s)
FOUR_DAYS_AGO=$(date --date='4 days ago' +%s)
npm view $PACKAGE_NAME time --json | jq -c 'to_entries | .[] | select(.key | test("^0.0.0-.+$"))' \
| while read line; do
VERSION=$(echo $line | jq -r '.key')
TIME=$(echo $line | jq -r '.value')
PUBLISH_DATE=$(date --date=$TIME +%s)
if [ $PUBLISH_DATE -lt $FOUR_DAYS_AGO ]; then
continue # skip versions older than 4 days to reduce the number of npm deprecate calls
fi
if [ $PUBLISH_DATE -lt $TWO_DAYS_AGO ]; then
echo "Deprecate $PACKAGE_NAME@$VERSION"
npm deprecate $PACKAGE_NAME@$VERSION "This canary version is deprecated because it is older than 2 days." || true
echo "Deprecated $PACKAGE_NAME@$VERSION"
fi
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Prune presets tags
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
npm view $PACKAGE_NAME dist-tags --json | jq -r 'to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "next") | .key' | xargs -I % npm dist-tag rm $PACKAGE_NAME %
working-directory: packages/presets
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deprecate canary versions
working-directory: packages/presets
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
TWO_DAYS_AGO=$(date --date='2 days ago' +%s)
FOUR_DAYS_AGO=$(date --date='4 days ago' +%s)
npm view $PACKAGE_NAME time --json | jq -c 'to_entries | .[] | select(.key | test("^0.0.0-.+$"))' \
| while read line; do
VERSION=$(echo $line | jq -r '.key')
TIME=$(echo $line | jq -r '.value')
PUBLISH_DATE=$(date --date=$TIME +%s)
if [ $PUBLISH_DATE -lt $FOUR_DAYS_AGO ]; then
continue # skip versions older than 4 days to reduce the number of npm deprecate calls
fi
if [ $PUBLISH_DATE -lt $TWO_DAYS_AGO ]; then
echo "Deprecate $PACKAGE_NAME@$VERSION"
npm deprecate $PACKAGE_NAME@$VERSION "This canary version is deprecated because it is older than 2 days." || true
echo "Deprecated $PACKAGE_NAME@$VERSION"
fi
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Prune ecdsa tags
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
npm view $PACKAGE_NAME dist-tags --json | jq -r 'to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "next") | .key' | xargs -I % npm dist-tag rm $PACKAGE_NAME %
working-directory: plugins/ecdsa
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deprecate canary versions
working-directory: plugins/ecdsa
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
TWO_DAYS_AGO=$(date --date='2 days ago' +%s)
FOUR_DAYS_AGO=$(date --date='4 days ago' +%s)
npm view $PACKAGE_NAME time --json | jq -c 'to_entries | .[] | select(.key | test("^0.0.0-.+$"))' \
| while read line; do
VERSION=$(echo $line | jq -r '.key')
TIME=$(echo $line | jq -r '.value')
PUBLISH_DATE=$(date --date=$TIME +%s)
if [ $PUBLISH_DATE -lt $FOUR_DAYS_AGO ]; then
continue # skip versions older than 4 days to reduce the number of npm deprecate calls
fi
if [ $PUBLISH_DATE -lt $TWO_DAYS_AGO ]; then
echo "Deprecate $PACKAGE_NAME@$VERSION"
npm deprecate $PACKAGE_NAME@$VERSION "This canary version is deprecated because it is older than 2 days." || true
echo "Deprecated $PACKAGE_NAME@$VERSION"
fi
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Prune modular permission tags
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
npm view $PACKAGE_NAME dist-tags --json | jq -r 'to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "next") | .key' | xargs -I % npm dist-tag rm $PACKAGE_NAME %
working-directory: plugins/modularPermission
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deprecate canary versions
working-directory: plugins/modularPermission
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
TWO_DAYS_AGO=$(date --date='2 days ago' +%s)
FOUR_DAYS_AGO=$(date --date='4 days ago' +%s)
npm view $PACKAGE_NAME time --json | jq -c 'to_entries | .[] | select(.key | test("^0.0.0-.+$"))' \
| while read line; do
VERSION=$(echo $line | jq -r '.key')
TIME=$(echo $line | jq -r '.value')
PUBLISH_DATE=$(date --date=$TIME +%s)
if [ $PUBLISH_DATE -lt $FOUR_DAYS_AGO ]; then
continue # skip versions older than 4 days to reduce the number of npm deprecate calls
fi
if [ $PUBLISH_DATE -lt $TWO_DAYS_AGO ]; then
echo "Deprecate $PACKAGE_NAME@$VERSION"
npm deprecate $PACKAGE_NAME@$VERSION "This canary version is deprecated because it is older than 2 days." || true
echo "Deprecated $PACKAGE_NAME@$VERSION"
fi
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Prune passkey tags
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
npm view $PACKAGE_NAME dist-tags --json | jq -r 'to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "next") | .key' | xargs -I % npm dist-tag rm $PACKAGE_NAME %
working-directory: plugins/passkey
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deprecate canary versions
working-directory: plugins/passkey
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
TWO_DAYS_AGO=$(date --date='2 days ago' +%s)
FOUR_DAYS_AGO=$(date --date='4 days ago' +%s)
npm view $PACKAGE_NAME time --json | jq -c 'to_entries | .[] | select(.key | test("^0.0.0-.+$"))' \
| while read line; do
VERSION=$(echo $line | jq -r '.key')
TIME=$(echo $line | jq -r '.value')
PUBLISH_DATE=$(date --date=$TIME +%s)
if [ $PUBLISH_DATE -lt $FOUR_DAYS_AGO ]; then
continue # skip versions older than 4 days to reduce the number of npm deprecate calls
fi
if [ $PUBLISH_DATE -lt $TWO_DAYS_AGO ]; then
echo "Deprecate $PACKAGE_NAME@$VERSION"
npm deprecate $PACKAGE_NAME@$VERSION "This canary version is deprecated because it is older than 2 days." || true
echo "Deprecated $PACKAGE_NAME@$VERSION"
fi
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Prune permission tags
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
npm view $PACKAGE_NAME dist-tags --json | jq -r 'to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "next") | .key' | xargs -I % npm dist-tag rm $PACKAGE_NAME %
working-directory: plugins/permission
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deprecate canary versions
working-directory: plugins/permission
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
TWO_DAYS_AGO=$(date --date='2 days ago' +%s)
FOUR_DAYS_AGO=$(date --date='4 days ago' +%s)
npm view $PACKAGE_NAME time --json | jq -c 'to_entries | .[] | select(.key | test("^0.0.0-.+$"))' \
| while read line; do
VERSION=$(echo $line | jq -r '.key')
TIME=$(echo $line | jq -r '.value')
PUBLISH_DATE=$(date --date=$TIME +%s)
if [ $PUBLISH_DATE -lt $FOUR_DAYS_AGO ]; then
continue # skip versions older than 4 days to reduce the number of npm deprecate calls
fi
if [ $PUBLISH_DATE -lt $TWO_DAYS_AGO ]; then
echo "Deprecate $PACKAGE_NAME@$VERSION"
npm deprecate $PACKAGE_NAME@$VERSION "This canary version is deprecated because it is older than 2 days." || true
echo "Deprecated $PACKAGE_NAME@$VERSION"
fi
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Prune session key tags
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
npm view $PACKAGE_NAME dist-tags --json | jq -r 'to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "next") | .key' | xargs -I % npm dist-tag rm $PACKAGE_NAME %
working-directory: plugins/session-key
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deprecate canary versions
working-directory: plugins/session-key
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
TWO_DAYS_AGO=$(date --date='2 days ago' +%s)
FOUR_DAYS_AGO=$(date --date='4 days ago' +%s)
npm view $PACKAGE_NAME time --json | jq -c 'to_entries | .[] | select(.key | test("^0.0.0-.+$"))' \
| while read line; do
VERSION=$(echo $line | jq -r '.key')
TIME=$(echo $line | jq -r '.value')
PUBLISH_DATE=$(date --date=$TIME +%s)
if [ $PUBLISH_DATE -lt $FOUR_DAYS_AGO ]; then
continue # skip versions older than 4 days to reduce the number of npm deprecate calls
fi
if [ $PUBLISH_DATE -lt $TWO_DAYS_AGO ]; then
echo "Deprecate $PACKAGE_NAME@$VERSION"
npm deprecate $PACKAGE_NAME@$VERSION "This canary version is deprecated because it is older than 2 days." || true
echo "Deprecated $PACKAGE_NAME@$VERSION"
fi
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Prune weighted key tags
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
npm view $PACKAGE_NAME dist-tags --json | jq -r 'to_entries | .[] | select(.key != "latest") | select(.key != "main") | select(.key != "next") | .key' | xargs -I % npm dist-tag rm $PACKAGE_NAME %
working-directory: plugins/weighted-ecdsa
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Deprecate canary versions
working-directory: plugins/weighted-ecdsa
run: |
PACKAGE_NAME=$(jq -r '.name' package.json)
TWO_DAYS_AGO=$(date --date='2 days ago' +%s)
FOUR_DAYS_AGO=$(date --date='4 days ago' +%s)
npm view $PACKAGE_NAME time --json | jq -c 'to_entries | .[] | select(.key | test("^0.0.0-.+$"))' \
| while read line; do
VERSION=$(echo $line | jq -r '.key')
TIME=$(echo $line | jq -r '.value')
PUBLISH_DATE=$(date --date=$TIME +%s)
if [ $PUBLISH_DATE -lt $FOUR_DAYS_AGO ]; then
continue # skip versions older than 4 days to reduce the number of npm deprecate calls
fi
if [ $PUBLISH_DATE -lt $TWO_DAYS_AGO ]; then
echo "Deprecate $PACKAGE_NAME@$VERSION"
npm deprecate $PACKAGE_NAME@$VERSION "This canary version is deprecated because it is older than 2 days." || true
echo "Deprecated $PACKAGE_NAME@$VERSION"
fi
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}