mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
chore: add inputs & remove-dist-tag script
This commit is contained in:
parent
c58b405b44
commit
e1dd3292f9
6
.github/workflows/experimental.yml
vendored
6
.github/workflows/experimental.yml
vendored
@ -2,6 +2,10 @@ name: 'Experimental Releases'
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
dist-tag:
|
||||
description: 'The tag you want to remove from NPM'
|
||||
default: 'experimental'
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
@ -22,4 +26,4 @@ jobs:
|
||||
- run: ./scripts/pre-publish.sh --yes
|
||||
env:
|
||||
VERSION: '0.0.0-experimental.${{ github.sha }}'
|
||||
DIST_TAG: experimental
|
||||
DIST_TAG: ${{ github.event.inputs.dist-tag }}
|
||||
|
||||
28
.github/workflows/remove-dist-tag.yml
vendored
Normal file
28
.github/workflows/remove-dist-tag.yml
vendored
Normal file
@ -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 }}
|
||||
29
scripts/remove-dist-tag.sh
Executable file
29
scripts/remove-dist-tag.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Force start from root folder
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
set -e
|
||||
|
||||
distTag=$DIST_TAG
|
||||
|
||||
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
|
||||
|
||||
# Get all the packages
|
||||
packages=$(./node_modules/.bin/lerna ls)
|
||||
|
||||
# Loop through the packages
|
||||
for package in $packages; do
|
||||
echo "Removing dist-tag $distTag from $package"
|
||||
# Run npm dist-tag rm $distTag
|
||||
npm dist-tag rm $package $distTag
|
||||
done
|
||||
Loading…
x
Reference in New Issue
Block a user