@intentius/chant 0.124.100 → 0.124.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-pins.d.ts +2 -0
- package/dist/action-pins.js +3 -0
- package/dist/ci-detect.d.ts +13 -0
- package/dist/ci-detect.js +12 -0
- package/dist/ci-evidence-claims.d.ts +12 -0
- package/dist/ci-evidence-claims.js +12 -0
- package/dist/ci-system.d.ts +66 -0
- package/dist/ci-system.js +61 -0
- package/dist/cli/handlers/build.js +27 -0
- package/dist/cli/handlers/release-doctor.d.ts +12 -0
- package/dist/cli/handlers/release-doctor.js +118 -0
- package/dist/cli/handlers/release-init.d.ts +10 -0
- package/dist/cli/handlers/release-init.js +374 -0
- package/dist/cli/handlers/release.d.ts +43 -2
- package/dist/cli/handlers/release.js +667 -39
- package/dist/cli/handlers/run-generate.js +11 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +44 -101
- package/dist/cli/parse-args.js +48 -0
- package/dist/cli/registry.d.ts +16 -0
- package/dist/cli/release-commands/artifacts.d.ts +3 -0
- package/dist/cli/release-commands/artifacts.js +14 -0
- package/dist/cli/release-commands/candidates.d.ts +3 -0
- package/dist/cli/release-commands/candidates.js +16 -0
- package/dist/cli/release-commands/changed.d.ts +3 -0
- package/dist/cli/release-commands/changed.js +14 -0
- package/dist/cli/release-commands/compose.d.ts +3 -0
- package/dist/cli/release-commands/compose.js +16 -0
- package/dist/cli/release-commands/cut.d.ts +3 -0
- package/dist/cli/release-commands/cut.js +50 -0
- package/dist/cli/release-commands/doctor.d.ts +3 -0
- package/dist/cli/release-commands/doctor.js +14 -0
- package/dist/cli/release-commands/export.d.ts +3 -0
- package/dist/cli/release-commands/export.js +12 -0
- package/dist/cli/release-commands/images.d.ts +3 -0
- package/dist/cli/release-commands/images.js +13 -0
- package/dist/cli/release-commands/index.d.ts +8 -0
- package/dist/cli/release-commands/index.js +52 -0
- package/dist/cli/release-commands/init.d.ts +3 -0
- package/dist/cli/release-commands/init.js +19 -0
- package/dist/cli/release-commands/list.d.ts +3 -0
- package/dist/cli/release-commands/list.js +10 -0
- package/dist/cli/release-commands/next.d.ts +3 -0
- package/dist/cli/release-commands/next.js +13 -0
- package/dist/cli/release-commands/publish.d.ts +3 -0
- package/dist/cli/release-commands/publish.js +22 -0
- package/dist/cli/release-commands/stamp.d.ts +3 -0
- package/dist/cli/release-commands/stamp.js +15 -0
- package/dist/cli/release-commands/status.d.ts +3 -0
- package/dist/cli/release-commands/status.js +17 -0
- package/dist/cli/release-commands/tag.d.ts +3 -0
- package/dist/cli/release-commands/tag.js +12 -0
- package/dist/cli/release-commands/types.d.ts +20 -0
- package/dist/cli/release-commands/types.js +1 -0
- package/dist/cli/release-commands/verify.d.ts +3 -0
- package/dist/cli/release-commands/verify.js +15 -0
- package/dist/cli/release-commands/workflow.d.ts +3 -0
- package/dist/cli/release-commands/workflow.js +15 -0
- package/dist/cloud-lister/index.d.ts +4 -1
- package/dist/cloud-lister/index.js +2 -1
- package/dist/cloud-lister/kubernetes-components.d.ts +56 -0
- package/dist/cloud-lister/kubernetes-components.js +642 -0
- package/dist/cloud-lister/kubernetes.d.ts +18 -0
- package/dist/cloud-lister/kubernetes.js +26 -1
- package/dist/cloud-lister/mask.d.ts +5 -1
- package/dist/cloud-lister/mask.js +14 -5
- package/dist/components/cli-support.d.ts +1 -1
- package/dist/components/cli-support.js +1 -1
- package/dist/config-environments.d.ts +8 -1
- package/dist/config-environments.js +2 -0
- package/dist/config-import.d.ts +1 -1
- package/dist/config-import.js +6 -2
- package/dist/config-sandbox.d.ts +1 -1
- package/dist/config-sandbox.js +3 -3
- package/dist/config.d.ts +369 -10
- package/dist/config.js +127 -7
- package/dist/deep-observation.js +9 -3
- package/dist/floor-table.data.js +21 -1
- package/dist/forge-remote.d.ts +13 -0
- package/dist/forge-remote.js +15 -0
- package/dist/lexicon.d.ts +45 -4
- package/dist/lifecycle/__fixtures__/package-files.d.ts +32 -0
- package/dist/lifecycle/__fixtures__/package-files.js +72 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +62 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.js +275 -3
- package/dist/lifecycle/publish-attachments.d.ts +2 -1
- package/dist/lifecycle/publish-attachments.js +19 -2
- package/dist/lifecycle/publish-cargo.d.ts +99 -0
- package/dist/lifecycle/publish-cargo.js +412 -0
- package/dist/lifecycle/publish-credentials.d.ts +1 -1
- package/dist/lifecycle/publish-credentials.js +13 -0
- package/dist/lifecycle/publish-declaration.d.ts +322 -4
- package/dist/lifecycle/publish-declaration.js +340 -9
- package/dist/lifecycle/publish-forge.d.ts +45 -2
- package/dist/lifecycle/publish-forge.js +434 -34
- package/dist/lifecycle/publish-git-ssh.d.ts +15 -0
- package/dist/lifecycle/publish-git-ssh.js +30 -4
- package/dist/lifecycle/publish-github.d.ts +40 -2
- package/dist/lifecycle/publish-github.js +100 -3
- package/dist/lifecycle/publish-helm.d.ts +83 -0
- package/dist/lifecycle/publish-helm.js +452 -0
- package/dist/lifecycle/publish-homebrew.d.ts +7 -9
- package/dist/lifecycle/publish-homebrew.js +34 -197
- package/dist/lifecycle/publish-index.d.ts +141 -0
- package/dist/lifecycle/publish-index.js +719 -0
- package/dist/lifecycle/publish-marketplace.js +77 -0
- package/dist/lifecycle/publish-maven.d.ts +79 -0
- package/dist/lifecycle/publish-maven.js +364 -0
- package/dist/lifecycle/publish-mcp-registry.d.ts +66 -0
- package/dist/lifecycle/publish-mcp-registry.js +305 -0
- package/dist/lifecycle/publish-npm.d.ts +27 -1
- package/dist/lifecycle/publish-npm.js +216 -3
- package/dist/lifecycle/publish-nuget.d.ts +93 -0
- package/dist/lifecycle/publish-nuget.js +377 -0
- package/dist/lifecycle/publish-oci.d.ts +91 -2
- package/dist/lifecycle/publish-oci.js +247 -8
- package/dist/lifecycle/publish-package-files.d.ts +16 -0
- package/dist/lifecycle/publish-package-files.js +39 -0
- package/dist/lifecycle/publish-pypi.d.ts +138 -0
- package/dist/lifecycle/publish-pypi.js +657 -0
- package/dist/lifecycle/publish-record.d.ts +6 -3
- package/dist/lifecycle/publish-record.js +6 -3
- package/dist/lifecycle/publish-rubygems.d.ts +84 -0
- package/dist/lifecycle/publish-rubygems.js +366 -0
- package/dist/lifecycle/publish-signing.d.ts +147 -0
- package/dist/lifecycle/publish-signing.js +257 -0
- package/dist/lifecycle/publish-targets.d.ts +37 -1
- package/dist/lifecycle/publish-targets.js +102 -0
- package/dist/lifecycle/publish-tauri.js +43 -0
- package/dist/lifecycle/publish-train-names.d.ts +57 -0
- package/dist/lifecycle/publish-train-names.js +123 -0
- package/dist/lifecycle/publish-verify.d.ts +121 -0
- package/dist/lifecycle/publish-verify.js +130 -0
- package/dist/lifecycle/query.js +8 -0
- package/dist/lifecycle/release-artifacts.d.ts +290 -0
- package/dist/lifecycle/release-artifacts.js +808 -0
- package/dist/lifecycle/release-changelog.d.ts +13 -1
- package/dist/lifecycle/release-changelog.js +35 -2
- package/dist/lifecycle/release-cut.d.ts +64 -4
- package/dist/lifecycle/release-cut.js +147 -34
- package/dist/lifecycle/release-doctor.d.ts +113 -0
- package/dist/lifecycle/release-doctor.js +1198 -0
- package/dist/lifecycle/release-green.d.ts +86 -0
- package/dist/lifecycle/release-green.js +286 -0
- package/dist/lifecycle/release-init-registries.d.ts +48 -0
- package/dist/lifecycle/release-init-registries.js +97 -0
- package/dist/lifecycle/release-init.d.ts +275 -0
- package/dist/lifecycle/release-init.js +984 -0
- package/dist/lifecycle/release-intents.d.ts +73 -0
- package/dist/lifecycle/release-intents.js +128 -0
- package/dist/lifecycle/release-next.d.ts +111 -0
- package/dist/lifecycle/release-next.js +251 -0
- package/dist/lifecycle/release-prerelease.d.ts +19 -0
- package/dist/lifecycle/release-prerelease.js +30 -0
- package/dist/lifecycle/release-publish.d.ts +256 -10
- package/dist/lifecycle/release-publish.js +247 -35
- package/dist/lifecycle/release-status-change.d.ts +226 -0
- package/dist/lifecycle/release-status-change.js +478 -0
- package/dist/lifecycle/release-status.d.ts +11 -0
- package/dist/lifecycle/release-status.js +1 -1
- package/dist/lifecycle/release-store.d.ts +73 -2
- package/dist/lifecycle/release-store.js +32 -1
- package/dist/lifecycle/release-tag.d.ts +142 -0
- package/dist/lifecycle/release-tag.js +322 -0
- package/dist/lifecycle/release-verify.d.ts +73 -1
- package/dist/lifecycle/release-verify.js +117 -2
- package/dist/lifecycle/release-version-formats.d.ts +73 -0
- package/dist/lifecycle/release-version-formats.js +570 -0
- package/dist/lifecycle/release-version.d.ts +58 -10
- package/dist/lifecycle/release-version.js +164 -36
- package/dist/lifecycle/release-workstation.d.ts +3 -2
- package/dist/lifecycle/release-workstation.js +3 -2
- package/dist/op/generate-pipeline.js +1 -1
- package/dist/op/local-executor.d.ts +1 -1
- package/dist/op/local-executor.js +2 -2
- package/dist/op/op-waves-evidence.js +9 -2
- package/dist/pr-forge-base.js +4 -2
- package/dist/pr-forge.d.ts +20 -2
- package/dist/pr-forge.js +46 -10
- package/dist/release-floors.d.ts +8 -1
- package/dist/release-floors.js +9 -2
- package/dist/sensitive-key.d.ts +12 -0
- package/dist/sensitive-key.js +52 -0
- package/dist/tool-pins.d.ts +40 -0
- package/dist/tool-pins.js +66 -0
- package/dist/ts-loader.d.ts +8 -0
- package/dist/ts-loader.js +19 -0
- package/dist/wave-runtime.mjs +345 -342
- package/dist/workspace/ci-forge.d.ts +17 -0
- package/dist/workspace/ci-forge.js +17 -0
- package/dist/workspace/ci-init.js +1 -1
- package/dist/workspace/composites.schema.json +1 -0
- package/dist/workspace/declaration.d.ts +8 -0
- package/dist/workspace/declaration.js +12 -0
- package/dist/workspace/declaration.schema.json +8 -0
- package/dist/workspace/environments.d.ts +2 -0
- package/dist/workspace/environments.js +1 -1
- package/dist/workspace/identity-gate-rule.d.ts +61 -5
- package/dist/workspace/identity-gate-rule.js +81 -12
- package/dist/workspace/lexicon-outputs.d.ts +1 -1
- package/dist/workspace/lexicon-outputs.js +1 -1
- package/dist/workspace/member-pipeline.d.ts +2 -1
- package/dist/workspace/member-pipeline.js +5 -2
- package/dist/workspace/reason-codes.d.ts +2 -0
- package/dist/workspace/reason-codes.js +3 -1
- package/dist/workspace/release-changed.d.ts +75 -4
- package/dist/workspace/release-changed.js +205 -34
- package/dist/workspace/release-changed.schema.json +20 -2
- package/dist/workspace/release-steps/artifacts.d.ts +7 -0
- package/dist/workspace/release-steps/artifacts.js +45 -0
- package/dist/workspace/release-steps/builds.d.ts +12 -0
- package/dist/workspace/release-steps/builds.js +38 -0
- package/dist/workspace/release-steps/doctor.d.ts +8 -0
- package/dist/workspace/release-steps/doctor.js +14 -0
- package/dist/workspace/release-steps/goreleaser.d.ts +16 -0
- package/dist/workspace/release-steps/goreleaser.js +36 -0
- package/dist/workspace/release-steps/green.d.ts +3 -0
- package/dist/workspace/release-steps/green.js +6 -0
- package/dist/workspace/release-steps/images.d.ts +22 -0
- package/dist/workspace/release-steps/images.js +59 -0
- package/dist/workspace/release-steps/index.d.ts +9 -0
- package/dist/workspace/release-steps/index.js +50 -0
- package/dist/workspace/release-steps/nfpm.d.ts +13 -0
- package/dist/workspace/release-steps/nfpm.js +29 -0
- package/dist/workspace/release-steps/nuget.d.ts +14 -0
- package/dist/workspace/release-steps/nuget.js +16 -0
- package/dist/workspace/release-steps/pypi.d.ts +15 -0
- package/dist/workspace/release-steps/pypi.js +21 -0
- package/dist/workspace/release-steps/qemu.d.ts +21 -0
- package/dist/workspace/release-steps/qemu.js +35 -0
- package/dist/workspace/release-steps/signing.d.ts +18 -0
- package/dist/workspace/release-steps/signing.js +30 -0
- package/dist/workspace/release-steps/stamp.d.ts +3 -0
- package/dist/workspace/release-steps/stamp.js +4 -0
- package/dist/workspace/release-steps/targets.d.ts +31 -0
- package/dist/workspace/release-steps/targets.js +40 -0
- package/dist/workspace/release-steps/types.d.ts +104 -0
- package/dist/workspace/release-steps/types.js +2 -0
- package/dist/workspace/release-steps/verify.d.ts +3 -0
- package/dist/workspace/release-steps/verify.js +4 -0
- package/dist/workspace/release-toolchains.d.ts +59 -0
- package/dist/workspace/release-toolchains.js +133 -0
- package/dist/workspace/release-train-workflow.d.ts +36 -0
- package/dist/workspace/release-train-workflow.js +121 -0
- package/dist/workspace/release-train.d.ts +3 -1
- package/dist/workspace/release-train.js +20 -3
- package/dist/workspace/release-workflow.d.ts +183 -59
- package/dist/workspace/release-workflow.js +570 -201
- package/dist/workspace/releases.schema.json +70 -1
- package/dist/workspace/search-contract.d.ts +1 -1
- package/dist/workspace/security.js +9 -2
- package/dist/workspace/train-cut.d.ts +182 -0
- package/dist/workspace/train-cut.js +504 -0
- package/dist/workspace/train-prepare.d.ts +64 -0
- package/dist/workspace/train-prepare.js +313 -0
- package/dist/workspace/train-publish.d.ts +177 -0
- package/dist/workspace/train-publish.js +574 -0
- package/dist/workspace/train-range-labels.d.ts +33 -0
- package/dist/workspace/train-range-labels.js +109 -0
- package/dist/workspace/train-shell.d.ts +5 -0
- package/dist/workspace/train-shell.js +17 -0
- package/dist/workspace/trust/check-evidence-report.d.ts +3 -7
- package/dist/workspace/trust/check-evidence-report.js +3 -7
- package/dist/workspace/trust/seal.d.ts +13 -3
- package/dist/workspace/trust/seal.js +14 -4
- package/dist/workspace/work-cli.d.ts +3 -2
- package/dist/workspace/work-cli.js +3 -2
- package/dist/workspace/workspace-ledger.d.ts +14 -1
- package/dist/workspace/workspace-ledger.js +33 -7
- package/package.json +1 -1
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Helm target (#5233): chart archives pushed to an OCI registry, and
|
|
3
|
+
* listed in a classic chart repository's `index.yaml`.
|
|
4
|
+
*
|
|
5
|
+
* Each chart is a `.tgz` as `helm package` writes it, or as a `helm` entry of
|
|
6
|
+
* `release.artifacts` packs it (./release-artifacts.ts). Its name, version
|
|
7
|
+
* and the rest of its `Chart.yaml` are read from the archive, and a chart
|
|
8
|
+
* whose version is not the release's label from its first digit is refused
|
|
9
|
+
* (`publish-helm-version-mismatch`).
|
|
10
|
+
*
|
|
11
|
+
* `oci`: the chart goes to `<repository>/<chart name>` as `helm push` puts
|
|
12
|
+
* it: an image manifest whose config is the chart's metadata as JSON
|
|
13
|
+
* (`application/vnd.cncf.helm.config.v1+json`) and whose one layer is the
|
|
14
|
+
* archive (`application/vnd.cncf.helm.chart.content.v1.tar+gzip`). The
|
|
15
|
+
* registry is spoken to as the `oci` target speaks to it (./publish-oci.ts),
|
|
16
|
+
* with the same credentials. The stage pushes by digest; the reveal tags
|
|
17
|
+
* the digest with the chart's version (`+` written `_`, as helm does), which
|
|
18
|
+
* is what `helm install oci://<repository>/<name> --version <version>` reads.
|
|
19
|
+
*
|
|
20
|
+
* `index`: a chart repository served from a branch of a GitHub repository,
|
|
21
|
+
* such as `gh-pages`. The index's entry for each chart is its `Chart.yaml`
|
|
22
|
+
* with `urls`, `created` and `digest`, as `helm repo index` writes it. With
|
|
23
|
+
* `url`, each chart is downloaded from there, such as the forge release a
|
|
24
|
+
* `forge` target attaches it to; without it, the archive is committed
|
|
25
|
+
* beside the index and named by its file name. The stage commits to
|
|
26
|
+
* `chant-publish/helm-<version>` at the branch's head, and the reveal
|
|
27
|
+
* fast-forwards the branch, or commits onto it when it moved. The index is
|
|
28
|
+
* read and added to, never rewritten: a version it lists with the same
|
|
29
|
+
* digest is left, and one it lists with another is refused
|
|
30
|
+
* (`publish-helm-version-taken`), since a chart version is never replaced.
|
|
31
|
+
* With `index`, the target reveals after every other target, since the
|
|
32
|
+
* index points at files they make downloadable.
|
|
33
|
+
*/
|
|
34
|
+
import { readFileSync } from "node:fs";
|
|
35
|
+
import { basename, posix } from "node:path";
|
|
36
|
+
import { gunzipSync } from "node:zlib";
|
|
37
|
+
import { readCredential } from "./publish-credentials.js";
|
|
38
|
+
import { GitHubRepo, githubApi } from "./publish-github.js";
|
|
39
|
+
import { fillUrl, releaseVersion } from "./publish-index.js";
|
|
40
|
+
import { Registry, ociCredential, parseRepository } from "./publish-oci.js";
|
|
41
|
+
import { bytesDigest, checkReleaseDigest, expandArtifactAssets, memberFile, publishTargetKey } from "./publish-targets.js";
|
|
42
|
+
import { trainName, waitUntilServed } from "./publish-train-names.js";
|
|
43
|
+
import { PublishTargetError } from "./release-publish.js";
|
|
44
|
+
import { NEXT_RELEASE } from "../release-floors.js";
|
|
45
|
+
import { emitYAML, parseYAML } from "../yaml.js";
|
|
46
|
+
/** The first chant that publishes a `helm` target (#5233). */
|
|
47
|
+
export const PUBLISH_HELM_FLOOR = NEXT_RELEASE;
|
|
48
|
+
/** The media type of a chart's config blob: its metadata as JSON. */
|
|
49
|
+
export const HELM_CONFIG_MEDIA_TYPE = "application/vnd.cncf.helm.config.v1+json";
|
|
50
|
+
/** The media type of a chart's archive layer. */
|
|
51
|
+
export const HELM_CHART_MEDIA_TYPE = "application/vnd.cncf.helm.chart.content.v1.tar+gzip";
|
|
52
|
+
const IMAGE_MANIFEST = "application/vnd.oci.image.manifest.v1+json";
|
|
53
|
+
/** The variable the index's token is read from when the declaration names none. */
|
|
54
|
+
export const HELM_INDEX_TOKEN_ENV = "GITHUB_TOKEN";
|
|
55
|
+
/**
|
|
56
|
+
* The `Chart.yaml` of a chart archive: the one file `<dir>/Chart.yaml` at the
|
|
57
|
+
* top of its gzipped tar. Reads ustar names, with a GNU long name or a PAX
|
|
58
|
+
* `path` in place of a short one. Null when the archive has none.
|
|
59
|
+
*/
|
|
60
|
+
export function chartYamlOf(gz) {
|
|
61
|
+
let tar;
|
|
62
|
+
try {
|
|
63
|
+
tar = gunzipSync(gz);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
let at = 0;
|
|
69
|
+
let longName = null;
|
|
70
|
+
const text = (b) => b.toString("utf-8").replace(/\0.*$/s, "");
|
|
71
|
+
while (at + 512 <= tar.length) {
|
|
72
|
+
const h = tar.subarray(at, at + 512);
|
|
73
|
+
if (h.every((b) => b === 0))
|
|
74
|
+
break;
|
|
75
|
+
const size = parseInt(text(h.subarray(124, 136)).trim() || "0", 8);
|
|
76
|
+
const type = String.fromCharCode(h[156]);
|
|
77
|
+
const prefix = text(h.subarray(345, 500));
|
|
78
|
+
const short = text(h.subarray(0, 100));
|
|
79
|
+
const body = tar.subarray(at + 512, at + 512 + size);
|
|
80
|
+
at += 512 + Math.ceil(size / 512) * 512;
|
|
81
|
+
if (type === "L") {
|
|
82
|
+
longName = text(body);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (type === "x") {
|
|
86
|
+
const m = /(?:^|\n)\d+ path=([^\n]*)\n/.exec(body.toString("utf-8"));
|
|
87
|
+
if (m)
|
|
88
|
+
longName = m[1];
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (type === "g")
|
|
92
|
+
continue;
|
|
93
|
+
const name = (longName ?? (prefix ? `${prefix}/${short}` : short)).replace(/^\.\//, "");
|
|
94
|
+
longName = null;
|
|
95
|
+
if ((type === "0" || type === "\0") && /^[^/]+\/Chart\.yaml$/.test(name))
|
|
96
|
+
return body.toString("utf-8");
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
/** Read a chart archive's metadata, refused (`publish-helm-not-a-chart`) when it holds no readable `Chart.yaml` with a name and a version. */
|
|
101
|
+
export function readChartArchive(path, bytes) {
|
|
102
|
+
const yaml = chartYamlOf(bytes);
|
|
103
|
+
const refuse = (why) => {
|
|
104
|
+
throw new PublishTargetError("publish-helm-not-a-chart", `${path} is not a Helm chart archive: ${why}`, "Name the .tgz helm package writes, or a helm entry of release.artifacts with artifact:<name>.");
|
|
105
|
+
};
|
|
106
|
+
if (yaml === null)
|
|
107
|
+
refuse("it is not a gzipped tar with a <chart>/Chart.yaml");
|
|
108
|
+
let metadata = {};
|
|
109
|
+
try {
|
|
110
|
+
metadata = parseYAML(yaml);
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
refuse(`its Chart.yaml is not YAML chant can read: ${err instanceof Error ? err.message : String(err)}`);
|
|
114
|
+
}
|
|
115
|
+
const name = metadata.name;
|
|
116
|
+
const version = metadata.version;
|
|
117
|
+
if (typeof name !== "string" || name === "")
|
|
118
|
+
refuse("its Chart.yaml has no name");
|
|
119
|
+
if (typeof version !== "string" || version === "")
|
|
120
|
+
refuse("its Chart.yaml has no version");
|
|
121
|
+
return { path, file: basename(path), bytes, digest: bytesDigest(bytes), name: name, version: version, metadata };
|
|
122
|
+
}
|
|
123
|
+
/** The OCI tag of a chart version: helm writes `+` as `_`, which a tag can't hold. */
|
|
124
|
+
export function helmOciTag(version) {
|
|
125
|
+
return version.replace(/\+/g, "_");
|
|
126
|
+
}
|
|
127
|
+
/** The config blob and the manifest `helm push` would make for a chart, with no time in them, so the same chart is the same digest. */
|
|
128
|
+
export function helmOciManifest(chart) {
|
|
129
|
+
const config = new Uint8Array(Buffer.from(JSON.stringify(chart.metadata)));
|
|
130
|
+
const annotations = { "org.opencontainers.image.title": chart.name, "org.opencontainers.image.version": chart.version };
|
|
131
|
+
if (typeof chart.metadata.description === "string" && chart.metadata.description !== "")
|
|
132
|
+
annotations["org.opencontainers.image.description"] = chart.metadata.description;
|
|
133
|
+
const manifest = new Uint8Array(Buffer.from(JSON.stringify({
|
|
134
|
+
schemaVersion: 2,
|
|
135
|
+
mediaType: IMAGE_MANIFEST,
|
|
136
|
+
config: { mediaType: HELM_CONFIG_MEDIA_TYPE, digest: bytesDigest(config), size: config.byteLength },
|
|
137
|
+
layers: [{ mediaType: HELM_CHART_MEDIA_TYPE, digest: chart.digest, size: chart.bytes.byteLength }],
|
|
138
|
+
annotations,
|
|
139
|
+
})));
|
|
140
|
+
return { config, manifest, digest: bytesDigest(manifest) };
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The index with each chart's entry added, or null when it lists every chart
|
|
144
|
+
* already with the same digest. A version it lists with another digest is
|
|
145
|
+
* refused.
|
|
146
|
+
*/
|
|
147
|
+
export function addToHelmIndex(existing, charts, created, where) {
|
|
148
|
+
let index;
|
|
149
|
+
if (existing === null || existing.trim() === "")
|
|
150
|
+
index = { apiVersion: "v1", entries: {} };
|
|
151
|
+
else {
|
|
152
|
+
try {
|
|
153
|
+
index = parseYAML(existing);
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
throw new PublishTargetError("publish-helm-index-unreadable", `${where} is not YAML chant can read: ${err instanceof Error ? err.message : String(err)}`, "Fix the index by hand, or point index.path at the chart repository's index.yaml.");
|
|
157
|
+
}
|
|
158
|
+
if (typeof index !== "object" || index === null || (index.entries !== undefined && (typeof index.entries !== "object" || index.entries === null))) {
|
|
159
|
+
throw new PublishTargetError("publish-helm-index-unreadable", `${where} is not a chart repository index: it has no entries map`);
|
|
160
|
+
}
|
|
161
|
+
index.entries ?? (index.entries = {});
|
|
162
|
+
index.apiVersion ?? (index.apiVersion = "v1");
|
|
163
|
+
}
|
|
164
|
+
let changed = false;
|
|
165
|
+
for (const { chart, url } of charts) {
|
|
166
|
+
const list = Array.isArray(index.entries[chart.name]) ? index.entries[chart.name] : [];
|
|
167
|
+
const hex = chart.digest.slice("sha256:".length);
|
|
168
|
+
const listed = list.find((e) => e.version === chart.version);
|
|
169
|
+
if (listed) {
|
|
170
|
+
if (listed.digest === hex)
|
|
171
|
+
continue;
|
|
172
|
+
throw new PublishTargetError("publish-helm-version-taken", `${where} lists ${chart.name} ${chart.version} with the digest ${String(listed.digest)}, and this chart is ${hex}`, "A chart version is never replaced: cut a new release, so the chart carries a new version.");
|
|
173
|
+
}
|
|
174
|
+
index.entries[chart.name] = [{ ...chart.metadata, urls: [url], created, digest: hex }, ...list];
|
|
175
|
+
changed = true;
|
|
176
|
+
}
|
|
177
|
+
if (!changed)
|
|
178
|
+
return null;
|
|
179
|
+
index.generated = created;
|
|
180
|
+
const { apiVersion, entries, generated, ...rest } = index;
|
|
181
|
+
return `${emitYAML({ apiVersion, entries, generated, ...rest }, 0).replace(/\n*$/, "")}\n`;
|
|
182
|
+
}
|
|
183
|
+
export function helmTarget(decl, deps) {
|
|
184
|
+
const fetchImpl = deps.fetch ?? ((url, init) => fetch(url, init));
|
|
185
|
+
const failed = "publish-helm-failed";
|
|
186
|
+
const ix = decl.index;
|
|
187
|
+
const branch = ix?.branch ?? "gh-pages";
|
|
188
|
+
const indexPath = ix?.path ?? "index.yaml";
|
|
189
|
+
const indexDir = posix.dirname(indexPath) === "." ? "" : posix.dirname(indexPath);
|
|
190
|
+
const tokenEnv = ix?.tokenEnv ?? HELM_INDEX_TOKEN_ENV;
|
|
191
|
+
const credentialEnv = [...(decl.oci ? [decl.oci.passwordEnv ?? "OCI_PASSWORD"] : []), ...(ix ? [tokenEnv] : [])];
|
|
192
|
+
const where = [decl.oci ? decl.oci.repository : null, ix ? `${ix.repo}@${branch}:${indexPath}` : null].filter(Boolean).join(" and ");
|
|
193
|
+
const now = () => new Date(deps.now ? deps.now() : Date.now()).toISOString();
|
|
194
|
+
/** Each chart named, read and checked against the release's record and its label. */
|
|
195
|
+
const charts = (ctx) => {
|
|
196
|
+
const version = releaseVersion(ctx.label);
|
|
197
|
+
const out = [];
|
|
198
|
+
for (const p of expandArtifactAssets(ctx.release, decl.charts)) {
|
|
199
|
+
const bytes = new Uint8Array(readFileSync(memberFile(ctx.cwd, p)));
|
|
200
|
+
checkReleaseDigest(ctx.release, "asset", ctx.cwd, p, [bytesDigest(bytes)]);
|
|
201
|
+
const chart = readChartArchive(p, bytes);
|
|
202
|
+
if (version !== null && chart.version !== version) {
|
|
203
|
+
throw new PublishTargetError("publish-helm-version-mismatch", `${p} is ${chart.name} ${chart.version}, and the release is labelled ${ctx.label}, so the chart's version would not be the release's`, "Pack the chart at the cut with a helm entry of release.artifacts, which sets its version from the label, or set version in Chart.yaml to the label from its first digit.");
|
|
204
|
+
}
|
|
205
|
+
if (out.some((c) => c.name === chart.name))
|
|
206
|
+
throw new PublishTargetError("publish-helm-chart-taken", `two of the charts are named ${chart.name}`, "Name each chart once.");
|
|
207
|
+
out.push(chart);
|
|
208
|
+
}
|
|
209
|
+
return out;
|
|
210
|
+
};
|
|
211
|
+
const ociRef = (chart) => `${decl.oci.repository.replace(/\/+$/, "")}/${chart.name}`;
|
|
212
|
+
const connect = (ctx, chart) => {
|
|
213
|
+
const repo = parseRepository(ociRef(chart));
|
|
214
|
+
const cred = ociCredential({ ...(decl.oci.usernameEnv ? { usernameEnv: decl.oci.usernameEnv } : {}), ...(decl.oci.passwordEnv ? { passwordEnv: decl.oci.passwordEnv } : {}) }, repo, ctx);
|
|
215
|
+
return { cred, registry: new Registry(repo, fetchImpl, cred, ctx, deps.sleep) };
|
|
216
|
+
};
|
|
217
|
+
const ociItem = (chart, digest) => ({ name: `${chart.file} (tag ${helmOciTag(chart.version)})`, destination: `${ociRef(chart)}@${digest}`, digest });
|
|
218
|
+
const token = (ctx) => {
|
|
219
|
+
const t = readCredential(ctx.env, [tokenEnv], ctx.redactor);
|
|
220
|
+
if (!t)
|
|
221
|
+
throw new PublishTargetError("publish-credentials-missing", `the helm target reads the token for ${ix.repo} from ${tokenEnv}, and it is not set`, `Set ${tokenEnv} to a token that may push to ${branch} of ${ix.repo}.`);
|
|
222
|
+
return t;
|
|
223
|
+
};
|
|
224
|
+
const github = (ctx) => new GitHubRepo(githubApi(ix.api, ctx.env), ix.repo, token(ctx), fetchImpl, ctx, failed);
|
|
225
|
+
/** Each chart and the URL the index gives it. */
|
|
226
|
+
const listed = (ctx, cs) => {
|
|
227
|
+
const version = releaseVersion(ctx.label) ?? "";
|
|
228
|
+
return cs.map((chart) => ({
|
|
229
|
+
chart,
|
|
230
|
+
url: ix.url ? fillUrl(ix.url, { tag: ctx.releaseTag ?? "", label: ctx.label ?? "", version, name: chart.file }) : chart.file,
|
|
231
|
+
path: indexDir ? `${indexDir}/${chart.file}` : chart.file,
|
|
232
|
+
}));
|
|
233
|
+
};
|
|
234
|
+
/** What the branch at `ref` needs: the index with the charts added, and each archive committed beside it when there is no `url`. */
|
|
235
|
+
const changesAt = async (repo, ref, ctx, cs) => {
|
|
236
|
+
const entries = listed(ctx, cs);
|
|
237
|
+
const now0 = await repo.file(indexPath, ref);
|
|
238
|
+
const created = ctx.cut?.timestamp ?? now();
|
|
239
|
+
const text = addToHelmIndex(now0 ? now0.bytes.toString("utf-8") : null, entries, created, `${ix.repo}@${ref}:${indexPath}`);
|
|
240
|
+
const out = [];
|
|
241
|
+
if (!ix.url) {
|
|
242
|
+
for (const e of entries) {
|
|
243
|
+
const there = await repo.file(e.path, ref);
|
|
244
|
+
if (!there || bytesDigest(new Uint8Array(there.bytes)) !== e.chart.digest)
|
|
245
|
+
out.push({ path: e.path, bytes: e.chart.bytes });
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (text !== null)
|
|
249
|
+
out.push({ path: indexPath, bytes: new Uint8Array(Buffer.from(text, "utf-8")) });
|
|
250
|
+
return out;
|
|
251
|
+
};
|
|
252
|
+
const indexItems = (ctx, cs, present) => listed(ctx, cs).flatMap((e) => [
|
|
253
|
+
...(ix.url ? [] : [{ name: e.chart.file, destination: `${ix.repo}@${branch}:${e.path}`, digest: e.chart.digest, ...(present ? { present: true } : {}) }]),
|
|
254
|
+
{ name: `${e.chart.name} ${e.chart.version} in ${indexPath}`, destination: `${ix.repo}@${branch}:${indexPath}`, ...(present ? { present: true } : {}) },
|
|
255
|
+
]);
|
|
256
|
+
const message = (ctx, cs) => `${cs.map((c) => `${c.name} ${c.version}`).join(", ")}${ctx.releaseTag ? `, released as ${ctx.releaseTag}` : ""}`;
|
|
257
|
+
const staging = (ctx) => `chant-publish/helm-${releaseVersion(ctx.label) ?? ctx.release.releaseDigest.slice(0, 12)}`;
|
|
258
|
+
const target = {
|
|
259
|
+
kind: "helm",
|
|
260
|
+
name: `helm ${decl.charts.join(", ")}`,
|
|
261
|
+
destination: where,
|
|
262
|
+
credentialEnv,
|
|
263
|
+
key: publishTargetKey(decl),
|
|
264
|
+
...(ix ? { revealsLast: true } : {}),
|
|
265
|
+
/** #5165: each chart, under the OCI repository it goes to and the index that lists it. */
|
|
266
|
+
async names(ctx) {
|
|
267
|
+
const provides = new Set();
|
|
268
|
+
let cs = [];
|
|
269
|
+
try {
|
|
270
|
+
cs = charts(ctx);
|
|
271
|
+
}
|
|
272
|
+
catch {
|
|
273
|
+
cs = [];
|
|
274
|
+
}
|
|
275
|
+
for (const c of cs) {
|
|
276
|
+
if (decl.oci)
|
|
277
|
+
provides.add(trainName("oci", ociRef(c)));
|
|
278
|
+
if (ix)
|
|
279
|
+
provides.add(trainName("index", `${ix.repo}/${c.name}`));
|
|
280
|
+
}
|
|
281
|
+
return { provides: [...provides], needs: [] };
|
|
282
|
+
},
|
|
283
|
+
/** #5165: whether each chart's version tag is in the registry and the index lists each version; null when the charts can't be read here. */
|
|
284
|
+
async published(ctx) {
|
|
285
|
+
let cs;
|
|
286
|
+
try {
|
|
287
|
+
cs = charts(ctx);
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
if (decl.oci) {
|
|
293
|
+
for (const c of cs)
|
|
294
|
+
if ((await connect(ctx, c).registry.getManifest(helmOciTag(c.version))) === null)
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
if (ix) {
|
|
298
|
+
if (!readCredential(ctx.env, [tokenEnv], ctx.redactor))
|
|
299
|
+
return null;
|
|
300
|
+
const there = await github(ctx).file(indexPath, branch);
|
|
301
|
+
if (!there)
|
|
302
|
+
return false;
|
|
303
|
+
let index;
|
|
304
|
+
try {
|
|
305
|
+
index = parseYAML(there.bytes.toString("utf-8"));
|
|
306
|
+
}
|
|
307
|
+
catch {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
for (const c of cs)
|
|
311
|
+
if (!(index.entries?.[c.name] ?? []).some((e) => e.version === c.version))
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
return true;
|
|
315
|
+
},
|
|
316
|
+
/** #5165: wait until each version tag names the chart's manifest, and the branch's index lists each chart. */
|
|
317
|
+
async visible(ctx, published) {
|
|
318
|
+
const oci = published.items.filter((i) => typeof i.digest === "string" && / \(tag [^)]+\)$/.test(i.name));
|
|
319
|
+
await waitUntilServed(ctx, deps, {
|
|
320
|
+
what: where,
|
|
321
|
+
code: "publish-helm-not-served",
|
|
322
|
+
check: async () => {
|
|
323
|
+
const missing = [];
|
|
324
|
+
for (const i of oci) {
|
|
325
|
+
const at = i.destination.lastIndexOf("@");
|
|
326
|
+
const ref = i.destination.slice(0, at);
|
|
327
|
+
const tag = /\(tag ([^)]+)\)$/.exec(i.name)[1];
|
|
328
|
+
const repo = parseRepository(ref);
|
|
329
|
+
const cred = ociCredential({ ...(decl.oci?.usernameEnv ? { usernameEnv: decl.oci.usernameEnv } : {}), ...(decl.oci?.passwordEnv ? { passwordEnv: decl.oci.passwordEnv } : {}) }, repo, ctx);
|
|
330
|
+
const got = await new Registry(repo, fetchImpl, cred, ctx, deps.sleep).getManifest(tag);
|
|
331
|
+
if (got?.digest !== i.digest)
|
|
332
|
+
missing.push(`${ref}:${tag}`);
|
|
333
|
+
}
|
|
334
|
+
if (ix && readCredential(ctx.env, [tokenEnv], ctx.redactor)) {
|
|
335
|
+
const names = published.items.map((i) => / in [^ ]+$/.exec(i.name) ? i.name.replace(/ in [^ ]+$/, "").split(" ") : null).filter((n) => n !== null && n.length === 2);
|
|
336
|
+
if (names.length > 0) {
|
|
337
|
+
const there = await github(ctx).file(indexPath, branch);
|
|
338
|
+
const index = there ? parseYAML(there.bytes.toString("utf-8")) : null;
|
|
339
|
+
for (const [name, version] of names)
|
|
340
|
+
if (!(index?.entries?.[name] ?? []).some((e) => e.version === version))
|
|
341
|
+
missing.push(`${name} ${version} in ${ix.repo}@${branch}:${indexPath}`);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return missing;
|
|
345
|
+
},
|
|
346
|
+
});
|
|
347
|
+
},
|
|
348
|
+
async plan(ctx) {
|
|
349
|
+
const cs = charts(ctx);
|
|
350
|
+
if (decl.oci)
|
|
351
|
+
for (const c of cs)
|
|
352
|
+
connect(ctx, c);
|
|
353
|
+
if (ix)
|
|
354
|
+
token(ctx);
|
|
355
|
+
return [...(decl.oci ? cs.map((c) => ociItem(c, helmOciManifest(c).digest)) : []), ...(ix ? indexItems(ctx, cs, false) : [])];
|
|
356
|
+
},
|
|
357
|
+
async stage(ctx) {
|
|
358
|
+
const cs = charts(ctx);
|
|
359
|
+
const items = [];
|
|
360
|
+
const state = {};
|
|
361
|
+
if (decl.oci) {
|
|
362
|
+
for (const c of cs) {
|
|
363
|
+
const { cred, registry } = connect(ctx, c);
|
|
364
|
+
const m = helmOciManifest(c);
|
|
365
|
+
if (await registry.hasManifest(m.digest, IMAGE_MANIFEST)) {
|
|
366
|
+
ctx.log(`${ociRef(c)} already holds ${m.digest}; the chart is not pushed again`);
|
|
367
|
+
items.push({ ...ociItem(c, m.digest), present: true });
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
ctx.log(`pushing ${c.path} to ${ociRef(c)} by digest ${m.digest}, ${cred ? `with credentials from ${cred.password.from}` : "anonymously"}; no tag moves yet`);
|
|
371
|
+
await registry.pushBlob(bytesDigest(m.config), () => m.config);
|
|
372
|
+
await registry.pushBlob(c.digest, () => c.bytes);
|
|
373
|
+
await registry.putManifest(m.digest, IMAGE_MANIFEST, m.manifest);
|
|
374
|
+
items.push(ociItem(c, m.digest));
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
if (ix) {
|
|
378
|
+
const repo = github(ctx);
|
|
379
|
+
const head = await repo.branchHead(branch);
|
|
380
|
+
if (!head)
|
|
381
|
+
throw new PublishTargetError(failed, `${ix.repo} has no branch ${branch}`, `Create ${branch} in ${ix.repo}, such as an empty branch GitHub Pages serves, or set index.branch.`);
|
|
382
|
+
const changes = await changesAt(repo, branch, ctx, cs);
|
|
383
|
+
if (changes.length === 0) {
|
|
384
|
+
ctx.log(`${branch} of ${ix.repo} already lists ${cs.map((c) => `${c.name} ${c.version}`).join(", ")}`);
|
|
385
|
+
items.push(...indexItems(ctx, cs, true));
|
|
386
|
+
state.present = "true";
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
const at = staging(ctx);
|
|
390
|
+
ctx.log(`committing ${changes.map((c) => c.path).join(", ")} to ${at} of ${ix.repo}, at ${branch}'s head ${head.slice(0, 12)}`);
|
|
391
|
+
const commit = await repo.commitTree(head, changes, message(ctx, cs));
|
|
392
|
+
if ((await repo.branchHead(at)) === null)
|
|
393
|
+
await repo.createBranch(at, commit);
|
|
394
|
+
else
|
|
395
|
+
await repo.moveRef(`heads/${at}`, commit, true);
|
|
396
|
+
items.push(...indexItems(ctx, cs, false));
|
|
397
|
+
Object.assign(state, { staging: at, commit });
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return { target: target.name, destination: target.destination, items, state };
|
|
401
|
+
},
|
|
402
|
+
async reveal(ctx, staged) {
|
|
403
|
+
const cs = charts(ctx);
|
|
404
|
+
const items = [];
|
|
405
|
+
if (decl.oci) {
|
|
406
|
+
for (const c of cs) {
|
|
407
|
+
const { registry } = connect(ctx, c);
|
|
408
|
+
const m = helmOciManifest(c);
|
|
409
|
+
const tag = helmOciTag(c.version);
|
|
410
|
+
const now0 = await registry.getManifest(tag);
|
|
411
|
+
if (now0?.digest === m.digest)
|
|
412
|
+
ctx.log(`${ociRef(c)}:${tag} already names ${m.digest}`);
|
|
413
|
+
else {
|
|
414
|
+
await registry.putManifest(tag, IMAGE_MANIFEST, m.manifest);
|
|
415
|
+
ctx.log(`tagged ${ociRef(c)}@${m.digest} ${tag}`);
|
|
416
|
+
}
|
|
417
|
+
items.push(ociItem(c, m.digest));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
if (ix) {
|
|
421
|
+
if (staged.state.present === "true") {
|
|
422
|
+
items.push(...indexItems(ctx, cs, true));
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
const repo = github(ctx);
|
|
426
|
+
const { staging: at, commit } = staged.state;
|
|
427
|
+
if (!at || !commit)
|
|
428
|
+
throw new PublishTargetError(failed, `the staged index for ${ix.repo} has no staging commit to reveal`, "Run the same publish again: it stages the index again.");
|
|
429
|
+
ctx.log(`fast-forwarding ${branch} of ${ix.repo} to ${commit.slice(0, 12)}`);
|
|
430
|
+
if (!(await repo.moveRef(`heads/${branch}`, commit, false))) {
|
|
431
|
+
const changes = await changesAt(repo, branch, ctx, cs);
|
|
432
|
+
if (changes.length === 0)
|
|
433
|
+
ctx.log(`${branch} moved since the stage and already lists the charts`);
|
|
434
|
+
else {
|
|
435
|
+
ctx.log(`${branch} moved since the stage; committing the index onto it`);
|
|
436
|
+
const head = await repo.branchHead(branch);
|
|
437
|
+
if (!head)
|
|
438
|
+
throw new PublishTargetError(failed, `${ix.repo} has no branch ${branch}`, `Create ${branch} in ${ix.repo}, or set index.branch.`);
|
|
439
|
+
const onto = await repo.commitTree(head, changes, message(ctx, cs));
|
|
440
|
+
if (!(await repo.moveRef(`heads/${branch}`, onto, false)))
|
|
441
|
+
throw new PublishTargetError(failed, `${branch} of ${ix.repo} moved again while the index was committed onto it`, "Run the same publish again: it commits the index onto the branch's new head.");
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
await repo.deleteRef(`heads/${at}`);
|
|
445
|
+
items.push(...indexItems(ctx, cs, false));
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return { target: target.name, destination: target.destination, items };
|
|
449
|
+
},
|
|
450
|
+
};
|
|
451
|
+
return target;
|
|
452
|
+
}
|
|
@@ -46,24 +46,22 @@
|
|
|
46
46
|
* The asset URLs are the declaration's `url` pattern, so the files must be
|
|
47
47
|
* downloadable there by the time the formula is: declare the `forge` target
|
|
48
48
|
* that attaches them before this one, and its reveal runs first.
|
|
49
|
+
*
|
|
50
|
+
* Since #5158 this target is the `index` target's `homebrew-tap` preset
|
|
51
|
+
* (./publish-index.ts) with the fields, kind, key, error codes and order it
|
|
52
|
+
* always had: it stages and reveals in the order declared, a refusal fails
|
|
53
|
+
* the publish, and each SHA-256 is of the file in the checkout.
|
|
49
54
|
*/
|
|
50
55
|
import type { HomebrewPublishDeclaration } from "./publish-declaration.js";
|
|
56
|
+
import { fillUrl, releaseVersion } from "./publish-index.js";
|
|
51
57
|
import { type PublishDeps, type PublishTarget } from "./release-publish.js";
|
|
58
|
+
export { fillUrl, releaseVersion };
|
|
52
59
|
/** The first chant that publishes a `homebrew` target (#4676). */
|
|
53
60
|
export declare const PUBLISH_HOMEBREW_FLOOR = "0.124.63";
|
|
54
61
|
/** The first chant that reads a homebrew target's `sshKeyEnv` (#4699). */
|
|
55
62
|
export declare const PUBLISH_HOMEBREW_SSH_KEY_FLOOR = "0.124.64";
|
|
56
63
|
/** The variable the tap token is read from when the declaration names none. */
|
|
57
64
|
export declare const HOMEBREW_TOKEN_ENV = "HOMEBREW_TAP_TOKEN";
|
|
58
|
-
/** A release's version for a package manager: its label from the first digit on, or null when the label has no digit. */
|
|
59
|
-
export declare function releaseVersion(label: string | null): string | null;
|
|
60
|
-
/** `pattern` with `{tag}`, `{label}`, `{version}` and `{name}` filled in, each URL-encoded except the tag's slashes. */
|
|
61
|
-
export declare function fillUrl(pattern: string, values: {
|
|
62
|
-
tag: string;
|
|
63
|
-
label: string;
|
|
64
|
-
version: string;
|
|
65
|
-
name: string;
|
|
66
|
-
}): string;
|
|
67
65
|
/** Render a formula template, or name what it can't fill. */
|
|
68
66
|
export declare function renderFormula(template: string, values: {
|
|
69
67
|
version: string;
|