mirror of
https://github.com/cmderdev/cmder.git
synced 2026-04-14 22:04:32 +08:00
Make artifact names clickable, use human-readable file sizes, and add rar to compression formats
Agent-Logs-Url: https://github.com/cmderdev/cmder/sessions/ce43a069-b966-4141-b4e1-3d201bc3ddbf Co-authored-by: DRSDavidSoft <4673812+DRSDavidSoft@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
1418da1c18
commit
aa801c2c17
25
.github/workflows/build.yml
vendored
25
.github/workflows/build.yml
vendored
@@ -174,10 +174,25 @@ jobs:
|
||||
|
||||
### 🗃️ Artifacts
|
||||
|
||||
| Artifact | Size | Download | Hash (SHA256) |
|
||||
| --- | --- | --- | --- |
|
||||
| Artifact | Size | Hash (SHA256) |
|
||||
| --- | --- | --- |
|
||||
"@
|
||||
|
||||
# Function to format file size in human-readable format
|
||||
function Format-FileSize {
|
||||
param([double]$Bytes)
|
||||
|
||||
if ($Bytes -ge 1GB) {
|
||||
return "{0:N2} GiB" -f ($Bytes / 1GB)
|
||||
} elseif ($Bytes -ge 1MB) {
|
||||
return "{0:N2} MiB" -f ($Bytes / 1MB)
|
||||
} elseif ($Bytes -ge 1KB) {
|
||||
return "{0:N2} KiB" -f ($Bytes / 1KB)
|
||||
} else {
|
||||
return "{0:N0} B" -f $Bytes
|
||||
}
|
||||
}
|
||||
|
||||
# Function to get artifact download URL with retry logic
|
||||
function Get-ArtifactDownloadUrl {
|
||||
param(
|
||||
@@ -216,7 +231,7 @@ jobs:
|
||||
foreach ($file in $buildFiles) {
|
||||
$artifact = $file.Name
|
||||
$path = $file.FullName
|
||||
$size = $file.Length / 1MB
|
||||
$sizeFormatted = Format-FileSize -Bytes $file.Length
|
||||
$hash = (Get-FileHash $path -Algorithm SHA256).Hash
|
||||
|
||||
# Try to get the actual artifact download URL
|
||||
@@ -232,13 +247,13 @@ jobs:
|
||||
# Determine emoji based on file type
|
||||
if ($artifact -match '\.txt$') {
|
||||
$emoji = "📄"
|
||||
} elseif ($artifact -match '\.(zip|7z)$') {
|
||||
} elseif ($artifact -match '\.(zip|rar|7z)$') {
|
||||
$emoji = "🗄️"
|
||||
} else {
|
||||
$emoji = "📦"
|
||||
}
|
||||
|
||||
$summary += "`n| $emoji ``$artifact`` | $([math]::Round($size, 2)) MB | [📥 Download$warning]($downloadUrl) | ``$hash`` |"
|
||||
$summary += "`n| $emoji [``$artifact``$warning]($downloadUrl) | $sizeFormatted | ``$hash`` |"
|
||||
}
|
||||
}
|
||||
$summary += "`n"
|
||||
|
||||
Reference in New Issue
Block a user