File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments