Skip to content

Commit cfe7e59

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

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

.github/workflows/deprecate.yaml

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

scripts/deprecate.sh

Whitespace-only changes.

0 commit comments

Comments
 (0)