Skip to content

Commit b7ebfe6

Browse files
authored
added unpublish workflow
1 parent 346a170 commit b7ebfe6

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

.github/workflows/unpublish.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Unpublish RC Package
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to unpublish (must contain rc, e.g., 1.0.0-rc.1)'
8+
required: true
9+
type: string
10+
confirm_unpublish:
11+
description: 'Type YES to confirm unpublishing'
12+
required: true
13+
default: ''
14+
15+
permissions:
16+
id-token: write
17+
18+
jobs:
19+
unpublish:
20+
if: ${{ github.event.inputs.confirm_unpublish == 'YES' && contains(github.event.inputs.version, 'rc') }}
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
- name: Set up Node.js
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: '20'
30+
registry-url: 'https://registry.npmjs.org'
31+
32+
- name: Set up pnpm
33+
uses: pnpm/action-setup@v2
34+
with:
35+
version: 8.9.2
36+
37+
- name: Install dependencies
38+
run: pnpm i
39+
40+
- name: Validate RC version
41+
run: |
42+
VERSION="${{ github.event.inputs.version }}"
43+
if [[ ! "$VERSION" =~ rc ]]; then
44+
echo "❌ Error: Cannot unpublish non-RC version ($VERSION)"
45+
echo "Only RC versions (containing 'rc') can be unpublished"
46+
exit 1
47+
fi
48+
echo "✅ Version $VERSION is valid for RC unpublishing"
49+
50+
- name: Audit Signatures
51+
run: npm audit signatures
52+
53+
- name: Unpublish RC package
54+
env:
55+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
56+
run: |
57+
echo "Unpublishing libwiz@${{ github.event.inputs.version }}"
58+
npm unpublish "libwiz@${{ github.event.inputs.version }}" --force
59+
echo "✅ Successfully unpublished libwiz@${{ github.event.inputs.version }}"

0 commit comments

Comments
 (0)