Skip to content

Commit c955dfc

Browse files
committed
chore: Add deprecation workflow
1 parent d5d20eb commit c955dfc

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/deprecate.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deprecate version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Package version'
8+
required: true
9+
type: string
10+
latest:
11+
description: 'Latest version'
12+
type: string
13+
14+
jobs:
15+
update-package:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Setup Node 22
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 22
23+
registry-url: 'https://registry.npmjs.org'
24+
cache: 'npm'
25+
- uses: codex-team/action-nodejs-package-info@v1
26+
id: package
27+
- name: Create and publish PR
28+
env:
29+
GH_TOKEN: ${{ secrets.YC_UI_BOT_GITHUB_TOKEN }}
30+
run: |
31+
set -e
32+
33+
PACKAGE=${{ steps.package.outputs.name }}
34+
LATEST=$(npm view $PACKAGE@latest | grep -e "$PACKAGE@[0-9.]*" -o)
35+
VERSION=${{ inputs.version }}
36+
TARGET=$PACKAGE@$VERSION
37+
38+
if [[ $LATEST == $TARGET ]];
39+
if [[ -z "${{ inputs.latest }}" ]];
40+
echo ::error 'Param `latest` should be configured to previous version, to deprecate latest version'
41+
fi
42+
fi
43+
44+
echo "Deprecate $TARGET"

0 commit comments

Comments
 (0)