@git.zone/cli 8.7.0 → 8.7.1

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.
@@ -229,7 +229,9 @@ export class GiteaSealedRelease {
229
229
  /**
230
230
  * Retains the verified sealed files in the tag's draft release and returns the attachment
231
231
  * identities it read back and hashed. Attachments that already match are kept; a draft
232
- * attachment that conflicts with the sealed set is replaced, never one of a published release.
232
+ * attachment that conflicts with the sealed set (an interrupted upload) is replaced, never one of
233
+ * a published release. A draft that already names another manifest holds an earlier build of the
234
+ * same commit: release builds are reproducible, so a different build is refused, never swapped in.
233
235
  */
234
236
  async retain({ tag, commit, manifestSha256, files }) {
235
237
  requireValue(/^v\d+\.\d+\.\d+$/.test(tag) && /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(commit) &&
@@ -243,6 +245,10 @@ export class GiteaSealedRelease {
243
245
  let release = await this.inspect(tag, commit);
244
246
  if (!release) release = await this.createDraft(tag, commit, manifestSha256);
245
247
  requireValue(release.draft, 'The release for this tag is already published and is never changed; rerun the job to verify it.');
248
+ requireValue(!release.manifestSha256 || release.manifestSha256 === manifestSha256,
249
+ `The unpublished draft ${tag} holds an earlier build of this commit with manifest sha256 ${release.manifestSha256}, `
250
+ + `but this build sealed ${manifestSha256}: the release build is not reproducible, and a rerun never replaces retained bytes `
251
+ + 'with a different build. Make the build reproducible, or delete the draft release to release a new build.');
246
252
  const retained = new Map();
247
253
  for (const asset of await this.assets(release.id)) {
248
254
  const file = files.find((item) => item.name === asset.name);
@@ -256,9 +262,9 @@ export class GiteaSealedRelease {
256
262
  `(${read.size} of ${asset.size} bytes), the sealed set ${file ? `has sha256 ${file.sha256}` : 'has no such file'}.`);
257
263
  await this.json(`/releases/${release.id}/assets/${asset.id}`, { method: 'DELETE' }, [204]);
258
264
  }
259
- if (release.manifestSha256 !== manifestSha256) {
265
+ if (!release.manifestSha256) {
260
266
  await this.requireDraft(tag, commit, release.id);
261
- this.log(`Describing the unpublished draft ${tag} with manifest sha256 ${manifestSha256} instead of ${release.manifestSha256 ?? 'none'}.`);
267
+ this.log(`Describing the unpublished draft ${tag}, which named no manifest, with manifest sha256 ${manifestSha256}.`);
262
268
  const edited = await this.json(`/releases/${release.id}`, { method: 'PATCH', headers: { 'Content-Type': 'application/json' },
263
269
  body: JSON.stringify({ body: releaseBody(manifestSha256) }) });
264
270
  const after = this.assertRelease(edited, tag, commit);
@@ -53,9 +53,15 @@ try {
53
53
  requireValue(process.env.GITHUB_OUTPUT, 'Expected the Actions step output file.');
54
54
  await fs.appendFile(process.env.GITHUB_OUTPUT, Object.entries(values).map(([key, value]) => `${key}=${value}\n`).join(''));
55
55
  };
56
- const runAdapter = (args) => {
56
+ const runAdapter = async (args) => {
57
57
  requireValue(Array.isArray(args) && args.length > 0 && args.every((value) => typeof value === 'string' && !value.includes('\0')), 'Expected an explicit component command argument array.');
58
- const environment = { ...process.env };
58
+ // Every build of the tag is dated with its commit (https://reproducible-builds.org/specs/source-date-epoch/),
59
+ // so tools that record or embed a time produce the same bytes on every attempt.
60
+ const sourceDateEpoch = (await exec('git', ['log', '-1', '--format=%ct', commit], { cwd: root })).stdout.trim();
61
+ requireValue(/^\d+$/.test(sourceDateEpoch), 'Could not read the tagged commit time.');
62
+ requireValue(process.env.SOURCE_DATE_EPOCH === undefined || process.env.SOURCE_DATE_EPOCH === sourceDateEpoch,
63
+ `SOURCE_DATE_EPOCH must be the tagged commit time ${sourceDateEpoch} when the job sets it.`);
64
+ const environment = { ...process.env, SOURCE_DATE_EPOCH: sourceDateEpoch };
59
65
  delete environment.GITHUB_TOKEN;
60
66
  delete environment.ACTIONS_RUNTIME_TOKEN;
61
67
  const name = `Component command ${JSON.stringify(args)}`;
@@ -175,7 +181,8 @@ try {
175
181
  retained = true;
176
182
  }
177
183
  } else if (found.state === 'incomplete') {
178
- console.error(`The draft release for ${tag} is incomplete (${found.reason}); building and sealing again.`);
184
+ console.error(`The draft release for ${tag} is incomplete (${found.reason}); building and sealing again`
185
+ + `${found.release.manifestSha256 ? `, which must reproduce manifest sha256 ${found.release.manifestSha256}` : ''}.`);
179
186
  }
180
187
  await setOutputs(retained ? { retained: 'true', manifest: found.release.manifestSha256 } : { retained: 'false' });
181
188
  } else if (command === 'prepare') {
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@git.zone/cli',
6
- version: '8.7.0',
6
+ version: '8.7.1',
7
7
  description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxlQUFlO0lBQ3JCLE9BQU8sRUFBRSxPQUFPO0lBQ2hCLFdBQVcsRUFBRSwrTEFBK0w7Q0FDN00sQ0FBQSJ9
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@git.zone/cli",
3
3
  "private": false,
4
- "version": "8.7.0",
4
+ "version": "8.7.1",
5
5
  "description": "A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.",
6
6
  "main": "dist_ts/index.js",
7
7
  "typings": "dist_ts/index.d.ts",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@aws-sdk/client-s3": "3.1095.0",
51
- "@git.zone/tsdoc": "^3.0.0",
52
- "@git.zone/tsdocker": "3.8.1",
51
+ "@git.zone/tsdoc": "^3.0.2",
52
+ "@git.zone/tsdocker": "3.10.0",
53
53
  "@git.zone/tspublish": "^2.1.0",
54
54
  "@lossless.org/client": "1.5.1",
55
55
  "@push.rocks/early": "^4.0.4",
package/readme.md CHANGED
@@ -1530,7 +1530,10 @@ attachments belong to the tag, and the job token can write them.
1530
1530
  complete set is retained and nothing is built. A draft that is not complete is
1531
1531
  rebuilt. A published release that is not complete stops the job.
1532
1532
  2. **Prepare** runs the component's prepare command, verifies the result with
1533
- TsPack, runs the verify command on it, and writes the release receipt.
1533
+ TsPack, runs the verify command on it, and writes the release receipt. Both
1534
+ commands run with `SOURCE_DATE_EPOCH` set to the tagged commit's time, so
1535
+ tools that record or embed a time build the same bytes on every attempt; a
1536
+ job that sets another value stops.
1534
1537
  3. **Retain** waits until Gitea has processed the pushed tag before it creates a
1535
1538
  draft, because Gitea publishes a release it finds for a tag when it processes
1536
1539
  the push (the same wait `gitzone release` uses; see [Gitea release attachments before npm](#gitea-release-attachments-before-npm)). The
@@ -1548,17 +1551,21 @@ attachments belong to the tag, and the job token can write them.
1548
1551
  again, publishes the draft and confirms the release and its attachment list
1549
1552
  anonymously.
1550
1553
 
1551
- A published attachment is never replaced and a release is never deleted. A draft
1552
- has never been public, so a draft attachment that conflicts with the sealed set
1553
- (an interrupted earlier attempt whose rebuild produced different bytes, or a file
1554
- outside the set) is replaced: right before each deletion the release must still
1555
- read back as a draft with the token and be invisible anonymously, and the job log
1556
- names the attachment and both digests. A draft that turns public meanwhile stops
1557
- the job before the next change.
1554
+ A published attachment is never replaced and a release is never deleted. A
1555
+ release build must be reproducible: a draft whose description names a manifest
1556
+ holds an earlier build of the same commit, and a rebuild that seals a different
1557
+ manifest is refused without changing the draft, naming both digests. Make the
1558
+ build reproducible, or delete the draft to release a new build. Within the same
1559
+ manifest, a draft attachment that conflicts with the sealed set (bytes an
1560
+ interrupted upload left, or a file outside the set) is replaced: right before
1561
+ each deletion the release must still read back as a draft with the token and be
1562
+ invisible anonymously, and the job log names the attachment and both digests. A
1563
+ draft that turns public meanwhile stops the job before the next change.
1558
1564
 
1559
1565
  After an interruption, rerun the job. A rerun after a complete draft or a
1560
1566
  published release resumes from its bytes without building; a rerun after an
1561
- incomplete draft rebuilds and completes it. The remote tag must match the sealed
1567
+ incomplete draft rebuilds, and completes it when the rebuild reproduces the
1568
+ manifest the draft names. The remote tag must match the sealed
1562
1569
  source commit. Unexpected API responses, a publicly visible draft, an incomplete
1563
1570
  published release and changed source identities stop before publication.
1564
1571
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@git.zone/cli',
6
- version: '8.7.0',
6
+ version: '8.7.1',
7
7
  description: 'A comprehensive CLI tool for enhancing and managing local development workflows with gitzone utilities, focusing on project setup, version control, code formatting, and template management.'
8
8
  }