forked from strapi/strapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request strapi#16254 from strapi/chore/handle-dist-tags
- Loading branch information
Showing
3 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: 'Remove dist-tag from NPM' | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dist-tag: | ||
description: 'The tag you want to remove from NPM' | ||
required: true | ||
|
||
permissions: | ||
contents: read # to fetch code (actions/checkout) | ||
|
||
jobs: | ||
publish: | ||
name: 'Publish' | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'strapi/strapi' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup npmrc | ||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- run: yarn | ||
- run: ./scripts/remove-dist-tag | ||
env: | ||
DIST_TAG: ${{ github.event.inputs.dist-tag }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# Force start from root folder | ||
cd "$(dirname "$0")/.." | ||
|
||
set -e | ||
|
||
distTag=$DIST_TAG | ||
|
||
# trim distTag for whitespace at the start and end | ||
distTag=$(echo "$distTag" | xargs) | ||
|
||
if [[ -z "$distTag" ]]; then | ||
echo "Please enter the dist-tag you want to remove" | ||
read -r distTag | ||
fi | ||
|
||
# Check if dist tag is latest, beta, alpha or next and reject | ||
if [[ "$distTag" == "latest" || "$distTag" == "beta" || "$distTag" == "alpha" || "$distTag" == "next" ]]; then | ||
echo "You cannot remove the dist-tag $distTag" | ||
exit 1 | ||
fi | ||
|
||
# Run npm dist-tag rm $distTag on each package | ||
./node_modules/.bin/lerna exec --no-private --stream -- "npm dist-tag rm \$LERNA_PACKAGE_NAME $distTag" |