feat: update Dockerfile and release management scripts
Docker images / prepare-release (push) Successful in 6s
Docker images / backend-image (push) Successful in 1m45s
Docker images / frontend-image (push) Successful in 1m37s
Docker images / updater-image (push) Successful in 37s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 6s

- Replaced the public directory creation step with a direct copy in the Dockerfile for improved build efficiency.
- Enhanced the compute-release script to retrieve all tags and manage release manifests more effectively, including better handling of published timestamps and commit details.
- Updated the ReleasesPage component to conditionally format the published date based on the build type, improving user clarity on release status.
This commit is contained in:
Denozordec
2026-05-12 17:39:50 +07:00
parent 7207d1b749
commit 35876fcd6f
3 changed files with 67 additions and 37 deletions
+54 -29
View File
@@ -86,16 +86,50 @@ function parseCommit(subject, body = "") {
return { type, scope, description, bump }
}
function getLatestTag() {
function getAllTags() {
try {
const tags = git("tag", "--list", "v*.*.*", "--sort=-v:refname")
const first = tags.split("\n").map((line) => line.trim()).find(Boolean)
return first ?? null
return git("tag", "--list", "v*.*.*", "--sort=-v:refname")
.split("\n")
.map((line) => line.trim())
.filter(Boolean)
} catch {
return []
}
}
function getPreviousTag(tag) {
const tags = getAllTags()
const index = tags.indexOf(tag)
return index >= 0 && index + 1 < tags.length ? tags[index + 1] : null
}
function getTagPublishedAt(tag) {
try {
return git("log", "-1", "--format=%aI", tag)
} catch {
return null
}
}
function toManifestCommits(commits) {
return commits.map((commit) => ({
sha: commit.sha,
shortSha: commit.shortSha,
subject: commit.subject,
author: commit.author,
type: commit.type,
}))
}
function writeManifest(manifest) {
mkdirSync(outputDir, { recursive: true })
writeFileSync(join(outputDir, "release-manifest.json"), `${JSON.stringify(manifest, null, 2)}\n`, "utf8")
}
function getLatestTag() {
return getAllTags()[0] ?? null
}
function getCommitsSince(tag) {
const range = tag ? `${tag}..HEAD` : "HEAD"
const raw = git(
@@ -174,28 +208,25 @@ function main() {
const commits = getCommitsSince(latestTag)
if (commits.length === 0) {
const deployTag = latestTag ?? `v${baseFromTag}`
const deployVersion = baseFromTag
const displayCommits = latestTag ? getCommitsSince(getPreviousTag(latestTag)) : []
const publishedAt = latestTag ? getTagPublishedAt(latestTag) : null
mkdirSync(outputDir, { recursive: true })
writeFileSync(join(outputDir, "release_notes.md"), "", "utf8")
writeFileSync(
join(outputDir, "release-manifest.json"),
`${JSON.stringify(
{
version: baseFromTag,
tag: latestTag ?? `v${baseFromTag}`,
publishedAt: null,
releaseUrl: latestTag ? buildReleaseUrl(latestTag) : "",
commits: [],
},
null,
2,
)}\n`,
"utf8",
)
writeManifest({
version: deployVersion,
tag: deployTag,
publishedAt,
releaseUrl: latestTag ? buildReleaseUrl(latestTag) : "",
commits: toManifestCommits(displayCommits),
})
writeGithubOutput({
should_release: "false",
version: baseFromTag,
tag: latestTag ?? `v${baseFromTag}`,
version: deployVersion,
tag: deployTag,
bump: "none",
release_url: latestTag ? buildReleaseUrl(latestTag) : "",
})
@@ -213,18 +244,12 @@ function main() {
tag,
publishedAt,
releaseUrl,
commits: commits.map((commit) => ({
sha: commit.sha,
shortSha: commit.shortSha,
subject: commit.subject,
author: commit.author,
type: commit.type,
})),
commits: toManifestCommits(commits),
}
mkdirSync(outputDir, { recursive: true })
writeFileSync(join(outputDir, "release_notes.md"), releaseNotes, "utf8")
writeFileSync(join(outputDir, "release-manifest.json"), `${JSON.stringify(manifest, null, 2)}\n`, "utf8")
writeManifest(manifest)
writeGithubOutput({
should_release: "true",