mirror of
https://github.com/certd/certd.git
synced 2026-04-03 14:10:54 +08:00
chore: publish
This commit is contained in:
@@ -7,7 +7,9 @@ export function getVersionContent() {
|
||||
const changelog = fs.readFileSync('./CHANGELOG.md', 'utf8')
|
||||
// 解析CHANGELOG.md
|
||||
let lines = changelog.split('\n')
|
||||
const versionLineIndex = lines.findIndex(line => line.startsWith('## '))
|
||||
const versionLineIndex = lines.findIndex(line => {
|
||||
return line.startsWith('## [') || line.startsWith('# [')
|
||||
})
|
||||
const versionLine = lines[versionLineIndex]
|
||||
// ## [1.37.16](https://github.com/certd/certd/compare/v1.37.15...v1.37.16) (2025-12-15)
|
||||
const versionTitle = versionLine.match(/\[(.*?)\]/)[1]
|
||||
|
||||
@@ -152,15 +152,24 @@ async function uploadFile(url, headers, data) {
|
||||
|
||||
async function publishToAtomgit() {
|
||||
const { versionTitle, content } = getVersionContent()
|
||||
const release = await createRelease(versionTitle, content)
|
||||
const uploadUrl = await getUploadUrl(versionTitle)
|
||||
const fileName = `./packages/ui/certd-client/ui.zip`
|
||||
const fileData = fs.createReadStream(fileName)
|
||||
const contentLength = fs.statSync(fileName).size
|
||||
uploadUrl.headers['Content-Length'] = contentLength
|
||||
const response = await uploadFile(uploadUrl.url, uploadUrl.headers, fileData)
|
||||
console.log("uploadFile success:")
|
||||
console.log("publishToAtomgit success")
|
||||
try{
|
||||
const release = await createRelease(versionTitle, content)
|
||||
const uploadUrl = await getUploadUrl(versionTitle)
|
||||
const fileName = `./packages/ui/certd-client/ui.zip`
|
||||
const fileData = fs.createReadStream(fileName)
|
||||
const contentLength = fs.statSync(fileName).size
|
||||
uploadUrl.headers['Content-Length'] = contentLength
|
||||
const response = await uploadFile(uploadUrl.url, uploadUrl.headers, fileData)
|
||||
console.log("uploadFile success:")
|
||||
console.log("publishToAtomgit success")
|
||||
}catch(error){
|
||||
if (error?.response?.data){
|
||||
console.log("publishToAtomgit error:",error.response.data)
|
||||
}else{
|
||||
console.log("publishToAtomgit error:",error)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
publishToAtomgit()
|
||||
@@ -33,7 +33,11 @@ async function publishToGitee() {
|
||||
const release = await createRelease(versionTitle, content)
|
||||
console.log("publishToGitee success")
|
||||
} catch (error) {
|
||||
console.error("publishToGitee error:", error)
|
||||
if (error?.response?.data){
|
||||
console.log("publishToGitee error:",error.response.data)
|
||||
}else{
|
||||
console.log("publishToGitee error:",error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user