Skip to content

Commit

Permalink
build(.github): more resilient cleanup routine
Browse files Browse the repository at this point in the history
  • Loading branch information
Xunnamius committed Dec 30, 2020
1 parent f0e4a8a commit 85b8e12
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
export BRANCHES
DIST_TAGS=`npm dist-tag list @xunnamius/do-not-install`
export DIST_TAGS
MATCHED_TAGS=$(node -e 'const match = require("micromatch"); const tags = process.env.DIST_TAGS.split("\n").map(t => t.split(":")[0]); const branches = match(process.env.BRANCHES.split("\n"), require("./release.config.js").branches.reduce((a,b) => [...a, b.name || b.toString()], [])); const ignoreTags = process.env.IGNORE_TAGS.split(", "); console.log(tags.reduce((a,t) => branches.some(b => ignoreTags.includes(t) || t == b || t == `release-${b}`) ? a : [...a, t], []).join(" "))')
MATCHED_TAGS=$(node -e 'const match = require("micromatch"); const tags = process.env.DIST_TAGS.split("\n").map(t => t.split(":")[0]); const branches = match(process.env.BRANCHES.split("\n"), require("./release.config.js").branches.reduce((a,b) => [...a, b.name || b.toString()], [])); const ignoreTags = process.env.IGNORE_TAGS.split(", "); console.log(tags.reduce((a,t) => branches.some(b => ignoreTags.includes(t) || t == b || t == `release-${b}`) ? a : [...a, t], []).join(" ").trim())')
PKG_NAME=`node -e 'console.log(require("./package.json").name)'`
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
echo $MATCHED_TAGS | xargs -n1 npm dist-tag rm "$PKG_NAME"
! [ -z "$MATCHED_TAGS" ] && echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc && echo $MATCHED_TAGS | xargs -n1 npm dist-tag rm "$PKG_NAME"

0 comments on commit 85b8e12

Please sign in to comment.