This commit is contained in:
@@ -29,4 +29,28 @@ jobs:
|
||||
run: npm run build
|
||||
|
||||
- name: Publish package
|
||||
run: npm publish
|
||||
run: |
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://verdaccio:4873/windychen-utils/$VERSION)
|
||||
if [ "$HTTP_CODE" = "200" ]; then
|
||||
echo "Version $VERSION already exists in Verdaccio, skipping publish."
|
||||
else
|
||||
echo "Version $VERSION not found, publishing..."
|
||||
npm publish
|
||||
fi
|
||||
|
||||
- name: Notify DingTalk
|
||||
if: always()
|
||||
run: |
|
||||
STATUS="${{ job.status }}"
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
if [ "$STATUS" = "success" ]; then
|
||||
TITLE="✅ windychen-utils v${VERSION} 构建成功 chen-fnos"
|
||||
DETAIL="包已发布到 Verdaccio http://verdaccio:4873/"
|
||||
else
|
||||
TITLE="❌ windychen-utils v${VERSION} 构建失败 chen-fnos"
|
||||
DETAIL="请检查 Actions 日志"
|
||||
fi
|
||||
curl -s -X POST "https://oapi.dingtalk.com/robot/send?access_token=${{ secrets.DINGDING_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"msgtype\":\"markdown\",\"markdown\":{\"title\":\"${TITLE}\",\"text\":\"## ${TITLE}\n\n${DETAIL}\n\n- 仓库: windychen/windyChenUtils\n- 分支: ${{ github.ref_name }}\n- 提交: ${{ github.sha }}\"}}"
|
||||
|
||||
Reference in New Issue
Block a user