Unpublish RC Package #3
This file contains hidden or 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
| name: Unpublish RC Package | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to unpublish (must contain rc, e.g., 1.0.0-rc.1)' | |
| required: true | |
| type: string | |
| confirm_unpublish: | |
| description: 'Type YES to confirm unpublishing' | |
| required: true | |
| default: '' | |
| permissions: | |
| id-token: write | |
| jobs: | |
| unpublish: | |
| if: ${{ github.event.inputs.confirm_unpublish == 'YES' && contains(github.event.inputs.version, 'rc') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8.9.2 | |
| - name: Install dependencies | |
| run: pnpm i | |
| - name: Validate RC version | |
| run: | | |
| VERSION="${{ github.event.inputs.version }}" | |
| if [[ ! "$VERSION" =~ rc ]]; then | |
| echo "❌ Error: Cannot unpublish non-RC version ($VERSION)" | |
| echo "Only RC versions (containing 'rc') can be unpublished" | |
| exit 1 | |
| fi | |
| echo "✅ Version $VERSION is valid for RC unpublishing" | |
| - name: Audit Signatures | |
| run: npm audit signatures | |
| - name: Unpublish RC package | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: | | |
| echo "Unpublishing libwiz@${{ github.event.inputs.version }}" | |
| npm unpublish "libwiz@${{ github.event.inputs.version }}" --force | |
| echo "✅ Successfully unpublished libwiz@${{ github.event.inputs.version }}" |