From ce8c36ae0f1bb1423caffd1e9d4b9b5dcd2f3fb5 Mon Sep 17 00:00:00 2001 From: windychen Date: Thu, 16 Jul 2026 11:04:33 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20Publish=20=E6=AD=A5=E9=AA=A4=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=89=88=E6=9C=AC=E5=8E=BB=E9=87=8D=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=20+=20=E9=92=89=E9=92=89=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yaml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 70b92a5..821c57a 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -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 }}\"}}"