Skip to content

Commit f10d592

Browse files
committed
include asset files in release archive
1 parent fc34683 commit f10d592

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ let package:Package = .init(
139139
dependencies: [
140140
.target(name: "System_ArgumentParser"),
141141
.target(name: "S3Client"),
142+
.target(name: "UnidocAssets_System"),
142143
]),
143144

144145

Sources/unidoc-publish/Main.swift

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import NIOSSL
66
import S3
77
import S3Client
88
import System
9+
import Unidoc
10+
import UnidocAssets_System
911

1012
struct Main
1113
{
@@ -58,12 +60,31 @@ extension AWS.S3.Client
5860

5961
print("Compressing \(name)...")
6062

61-
try SystemProcess.init(command: "tar",
62-
// Sadly, tar on macOS doesn’t support this option.
63-
// "--use-compress-program='gzip -9'",
64-
"-C", "\(release)",
63+
var arguments:[String] = [
6564
"-czf", "\(archive)",
66-
name)()
65+
"-C", ".",
66+
]
67+
68+
let assets:FilePath.Directory = "Assets"
69+
for asset:Unidoc.Asset in [
70+
.main_css,
71+
.main_css_map,
72+
.main_js,
73+
.main_js_map,
74+
.literata45_woff2,
75+
.literata47_woff2,
76+
.literata75_woff2,
77+
.literata77_woff2
78+
]
79+
{
80+
arguments.append("\(assets.path.appending(asset.source))")
81+
}
82+
// This needs to come after the `.` location, as each `-C` is relative to the last.
83+
arguments.append("-C")
84+
arguments.append("\(release)")
85+
arguments.append(name)
86+
87+
try SystemProcess.init(command: "tar", arguments: arguments, echo: true)()
6788
let file:[UInt8] = try archive.read()
6889

6990
try await self.connect

0 commit comments

Comments
 (0)