This commit is contained in:
@@ -49,8 +49,8 @@ jobs:
|
||||
run: |
|
||||
npm config set //gitea:3000/api/packages/windychen/npm/:_authToken ${{ secrets.NPM_GITEA_TOKEN }}
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://gitea:3000/api/packages/windychen/npm/windychen-utils/$VERSION)
|
||||
if [ "$HTTP_CODE" = "200" ]; then
|
||||
EXISTS=$(curl -s "http://gitea:3000/api/v1/packages/windychen?q=windychen-utils" -H "Authorization: token ${{ secrets.NPM_GITEA_TOKEN }}" | grep -c "\"version\":\"$VERSION\"")
|
||||
if [ "$EXISTS" -gt 0 ]; then
|
||||
echo "Gitea: version $VERSION already exists, skipping."
|
||||
echo "Gitea|skipped|版本 ${VERSION} 已存在" >> /tmp/publish_result.txt
|
||||
else
|
||||
@@ -66,11 +66,16 @@ jobs:
|
||||
if: always() && steps.publish-gitea.outcome == 'success'
|
||||
run: |
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
EXISTS=$(curl -s "http://gitea:3000/api/v1/repos/windychen/windyChenUtils/releases/tags/v${VERSION}" -H "Authorization: token ${{ secrets.NPM_GITEA_TOKEN }}" | grep -c "\"tag_name\"")
|
||||
if [ "$EXISTS" = "0" ]; then
|
||||
curl -s -X POST \
|
||||
"http://gitea:3000/api/v1/repos/windychen/windyChenUtils/releases" \
|
||||
-H "Authorization: token ${{ secrets.NPM_GITEA_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"v${VERSION}\",\"name\":\"v${VERSION}\",\"body\":\"## windychen-utils v${VERSION}\n\n- 发布到 Verdaccio\n- 发布到 Gitea Packages\",\"target_commitish\":\"main\"}"
|
||||
else
|
||||
echo "Release v${VERSION} already exists, skipping."
|
||||
fi
|
||||
|
||||
- name: Notify DingTalk
|
||||
if: always()
|
||||
|
||||
Reference in New Issue
Block a user