aboutsummaryrefslogtreecommitdiff
path: root/yeetfile.js
blob: 946e7642374a59749e73173e595e0af9040c32c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
yeet.setenv("KO_DOCKER_REPO", "ghcr.io/xe/x");
yeet.setenv("SOURCE_DATE_EPOCH", $`git log -1 --format='%ct'`.trim());
yeet.setenv("VERSION", git.tag());

programs = [
  "aerial",
  "amano",
  "aura",
  "future-sight",
  "httpdebug",
  "quickserv",
  "relayd",
  "reverseproxyd",
  "sapientwindex",
  "stickers",
  "todayinmarch2020",
  "uncle-ted",
  "within.website",
].join(",");

$`ko build --platform=all --base-import-paths --tags=latest,${git.tag()} ./cmd/{${programs}}`;

yeet.setenv("CGO_ENABLED", "0");

const pkgs = [];

["amd64", "arm64"].forEach((goarch) => {
  [deb, rpm].forEach((method) => {
    pkgs.push(
      method.build({
        name: "ingressd",
        description: "ingress for my homelab",
        homepage: "https://within.website",
        license: "CC0",
        goarch,

        documentation: {
          LICENSE: "LICENSE",
        },

        build: ({ bin, systemd }) => {
          $`go build -o ${bin}/ingressd -ldflags '-s -w -extldflags "-static" -X "within.website/x.Version=${git.tag()}"' ./cmd/ingressd`;
          file.install(
            "./cmd/ingressd/ingressd.service",
            `${systemd}/ingressd.service`,
          );
        },
      }),
    );

    pkgs.push(
      method.build({
        name: "license",
        description: "software license generator",
        homepage: "https://within.website",
        license: "CC0",
        goarch,

        documentation: {
          LICENSE: "LICENSE",
        },

        build: ({ bin }) => {
          $`go build -o ${bin}/license -ldflags '-s -w -extldflags "-static" -X "within.website/x.Version=${git.tag()}"' ./cmd/license`;
        },
      }),
    );

    pkgs.push(
      method.build({
        name: "quickserv",
        description: "Like python3 -m http.server but a single binary",
        homepage: "https://within.website",
        license: "CC0",
        goarch,

        documentation: {
          LICENSE: "LICENSE",
        },

        build: ({ bin }) => {
          $`go build -o ${bin}/quickserv -ldflags '-s -w -extldflags "-static" -X "within.website/x.Version=${git.tag()}"' ./cmd/quickserv`;
        },
      }),
    );

    pkgs.push(
      method.build({
        name: "relayd",
        description: "TLS termination and client fingerprinting",
        homepage: "https://within.website",
        license: "CC0",
        goarch,

        documentation: {
          LICENSE: "LICENSE",
        },

        configFiles: {
          "cmd/relayd/relayd.env": "/etc/within.website/x/relayd.env",
        },

        build: ({ bin, systemd }) => {
          $`go build -o ${bin}/relayd -ldflags '-s -w -extldflags "-static" -X "within.website/x.Version=${git.tag()}"' ./cmd/relayd`;
          file.install(
            "./cmd/relayd/relayd.service",
            `${systemd}/relayd.service`,
          );
        },
      }),
    );

    pkgs.push(
      method.build({
        name: "uploud",
        description: "Upload images to the cloud!",
        homepage: "https://within.website",
        license: "CC0",
        goarch,

        documentation: {
          LICENSE: "LICENSE",
        },

        build: ({ bin }) => {
          $`go build -o ${bin}/uploud -ldflags '-s -w -extldflags "-static" -X "within.website/x.Version=${git.tag()}"' ./cmd/uploud`;
        },
      }),
    );

    pkgs.push(
      method.build({
        name: "x",
        description: "the universal x command",
        homepage: "https://within.website",
        license: "CC0",
        goarch,

        documentation: {
          LICENSE: "LICENSE",
        },

        build: ({ bin, systemd }) => {
          $`go build -o ${bin}/x -ldflags '-s -w -extldflags "-static" -X "within.website/x.Version=${git.tag()}"' ./cmd/x`;
        },
      }),
    );
  });
});