feat(ci): Release 添加 commit、构建时间、最近提交记录
This commit is contained in:
@@ -37,10 +37,21 @@ jobs:
|
||||
run: |
|
||||
tar -czf web.tar.gz -C client/build web
|
||||
VERSION="v$(date +%Y%m%d.%H%M)"
|
||||
COMMIT="${{ gitea.sha }}"
|
||||
COMMIT_MSG=$(git log -1 --pretty="%s" HEAD)
|
||||
RECENT_LOGS=$(git log -5 --pretty="- %s (%h)" HEAD)
|
||||
BODY="## 构建信息
|
||||
- **版本**: ${VERSION}
|
||||
- **Commit**: ${COMMIT}
|
||||
- **时间**: $(date '+%Y-%m-%d %H:%M:%S %Z')
|
||||
|
||||
## 最近提交
|
||||
${RECENT_LOGS}"
|
||||
|
||||
RESP=$(curl -s -X POST "${FORGEJO_URL}/api/v1/repos/${{ gitea.repository }}/releases" \
|
||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${VERSION}\",\"name\":\"Release ${VERSION}\",\"draft\":false,\"prerelease\":false}")
|
||||
-d "{\"tag_name\":\"${VERSION}\",\"name\":\"Release ${VERSION}\",\"body\":$(echo "$BODY" | python3 -c 'import sys,json; print(json.dumps(sys.stdin.read()))'),\"draft\":false,\"prerelease\":false}")
|
||||
echo "API response: ${RESP}"
|
||||
RELEASE_ID=$(echo "${RESP}" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
||||
curl -sf -X POST "${FORGEJO_URL}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets" \
|
||||
|
||||
Reference in New Issue
Block a user