-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (31 loc) · 962 Bytes
/
npm:unpublish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# unpublish from npm if it's Github Release was deleted/unpublished.
name: npm:unpublish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
on:
release:
types:
- deleted
- unpublished
jobs:
npm-unpublish:
runs-on: ubuntu-latest
env:
REL_VERSION: ${{ github.event.release.tag_name }}
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Setup latest Node
uses: actions/setup-node@v4
with:
node-version: 'latest'
registry-url: 'https://registry.npmjs.org'
- name: Unpublish from npm
run: |
n_version=$(echo "$REL_VERSION" | sed 's/[^0-9.]*//g')
pckg_name="$(npm pkg get name | tr -d '"')"
versioned="$pckg_name"@"$n_version"
output=$(npm unpublish "$versioned")
printf "::notice title=Unpublished ${versioned}::Output: ${output}"