In this section
- PipelineNews Mobile Orientation Candidate Workflow automation · pipelinenews / .github/workflows/202608272048-mobile-orientation-candidate.yml lines 701–1252
PipelineNews Mobile Orientation Candidate Workflow
A GitHub Actions workflow that builds and publishes the site. Runs on push and by hand.
automationpipelinenews / .github/workflows/202608272048-mobile-orientation-candidate.yml · lines 701–1252 of 1252 · version 2026-08-27 20:48 (continued from section 1845) · Entry point
- What it does
- It builds and publishes its content. Side effects: changes the web page (DOM); reads or writes files; makes network requests; starts processes.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (repository name word 'pipelinenews'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
- Inputs & outputs
- In: JSON file 202608272048-mobile-orientation-candidate.json; JSON file compiler-pass-a.json; JSON file compiler-pass-b.json; JSON file contract-proof.json; JSON file chronology-atlas-browser-proof.json; JSON file ui-compatibility-proof.json; JSON file run.json; JSON file source-envelope.json. Out: JSON file source-scope-proof.json; JSON file determinism-proof.json; JSON file pages-boundary-proof.json; JSON file source-envelope.json; JSON file run.json; JSON file repair-gate.json; GitHub Pages deployment.
- Downstream impact
- It is itself an entry point (workflow); no other file was found loading it.
- What it achieves
- Publishes to GitHub Pages.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- pipelinenews · .github/workflows · workflow
- Uses
- GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v8 Page (estate URL)
- Used by
- none found
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 .github/workflows/202608272048-mobile-orientation-candidate.yml:701-1252 · blob 6a0e6ae9eee1a1ea20ac437d41f78e67ab0df6c2 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, network, process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
if: needs.build.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 55
strategy:
fail-fast: false
max-parallel: 6
matrix:
include:
- id: candidate-static
target_ids: candidate
cell_ids: P1,P2,L1,L2,L3,L4,T1
include_rotate: "false"
- id: original-static
target_ids: original
cell_ids: P1,P2,L1,L2,L3,L4,T1
include_rotate: "false"
- id: baseline-a
target_ids: baseline
cell_ids: P1,P2,L1
include_rotate: "false"
- id: baseline-b
target_ids: baseline
cell_ids: L2,L3
include_rotate: "false"
- id: baseline-c
target_ids: baseline
cell_ids: L4,T1
include_rotate: "false"
- id: rotations
target_ids: candidate,baseline
cell_ids: none
include_rotate: "true"
env:
MOBILE_UI_MODE: repair
MOBILE_UI_TARGET_IDS: ${{ matrix.target_ids }}
MOBILE_UI_CELL_IDS: ${{ matrix.cell_ids }}
MOBILE_UI_INCLUDE_ROTATE: ${{ matrix.include_rotate }}
MOBILE_UI_SHARD_ID: ${{ matrix.id }}
MOBILE_UI_SOURCE_COMMIT: ${{ github.sha }}
MOBILE_UI_CANDIDATE_GENERATION: "202608272048"
MOBILE_UI_CANDIDATE_URL: http://127.0.0.1:4173/releases/202608272048-v8-fast-candidate.html
SHARD_RAW_DIR: work/202608272048-mobile-orientation/shards/${{ matrix.id }}/raw
steps:
- name: Checkout exact source
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
ref: ${{ github.sha }}
persist-credentials: false
- name: Configure Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: "22"
- name: Download verified closure
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
with:
name: pipelinenews-mobile-orientation-closure-202608272048-${{ github.run_id }}
path: ${{ env.ORIENTATION_WORK_ROOT }}/incoming
- name: Materialise closure and prove unchanged comparator
shell: bash
run: |
set -euo pipefail
mkdir -p "$SHARD_RAW_DIR"
node --input-type=module <<'NODE'
import assert from "node:assert/strict";
import { constants } from "node:fs";
import { copyFile, mkdir, readFile, writeFile } from "node:fs/promises";
import path from "node:path";
const incoming = path.resolve(process.env.ORIENTATION_WORK_ROOT, "incoming");
const generation = process.env.ORIENTATION_GENERATION;
const manifestPath = `build/${generation}-v8-fast-site-manifest.json`;
const manifest = JSON.parse(await readFile(path.join(incoming, manifestPath)));
assert.equal(manifest.source_commit, process.env.GITHUB_SHA);
assert.equal(manifest.github_run_id, process.env.GITHUB_RUN_ID);
assert.equal(manifest.deployment, "not-authorised");
const expected = [manifestPath, ...manifest.outputs.map(({ path: relative }) => relative)].sort();
assert.equal(expected.length, 5);
for (const relative of expected) {
const target = path.resolve(relative);
assert.ok(target.startsWith(`${process.cwd()}${path.sep}`));
await mkdir(path.dirname(target), { recursive: true });
await copyFile(path.join(incoming, relative), target, constants.COPYFILE_EXCL);
}
await writeFile(`${process.env.SHARD_RAW_DIR}/source-envelope.json`, `${JSON.stringify({
schema: "pipelinenews.mobile-orientation-repair-source-envelope.v1",
generation: process.env.ORIENTATION_AUDIT_GENERATION,
source_commit: process.env.GITHUB_SHA,
github_run_id: process.env.GITHUB_RUN_ID,
candidate_generation: generation,
candidate_source_parent: process.env.ORIENTATION_SOURCE_PARENT,
comparator_mode: "repair",
comparator_files: {
contract: "3dbee93a7de2cc01f9fece3e3318b1f151871231ae254bff9cc67fe4fd69aae2",
verifier: "f0f383cfd1a6ad0cc12f46a8a1173831ac7fed506cf4eabb59ae2d3e0ca68ca7",
comparator: "5fb162b9396db069dcd754c3deddc0bb0287522250265108426e7059ea342147",
},
project_posture: {
owner: "Ventus Ltd",
application: "non-commercial-open-source",
publisher_redistribution_rights: "source-specific-not-inferred",
},
deployment: "not-authorised",
}, null, 2)}\n`);
NODE
test "$(sha256sum atman/202608271656-mobile-ui-invariants.mjs | cut -d' ' -f1)" = \
"3dbee93a7de2cc01f9fece3e3318b1f151871231ae254bff9cc67fe4fd69aae2"
test "$(sha256sum atman/202608271656-verify-mobile-ui-browser.mjs | cut -d' ' -f1)" = \
"f0f383cfd1a6ad0cc12f46a8a1173831ac7fed506cf4eabb59ae2d3e0ca68ca7"
test "$(sha256sum atman/202608271656-compare-mobile-ui.mjs | cut -d' ' -f1)" = \
"5fb162b9396db069dcd754c3deddc0bb0287522250265108426e7059ea342147"
- name: Install pinned browser and screenshot encoder
shell: bash
run: |
set -euo pipefail
npm install --no-save --no-package-lock \
"playwright@$PLAYWRIGHT_VERSION" "sharp@$SHARP_VERSION"
test "$(node -p "require('playwright/package.json').version")" = "$PLAYWRIGHT_VERSION"
test "$(node -p "require('sharp/package.json').version")" = "$SHARP_VERSION"
npx playwright install --with-deps chromium
- name: Run unchanged 1656 verifier in repair mode
shell: bash
run: |
set -euo pipefail
python3 -m http.server 4173 --bind 127.0.0.1 --directory . \
> "$RUNNER_TEMP/$ORIENTATION_GENERATION-${MOBILE_UI_SHARD_ID}-http.log" 2>&1 &
server_pid="$!"
trap 'kill "$server_pid" 2>/dev/null || true' EXIT
for attempt in {1..30}; do
if curl --fail --silent --show-error "$MOBILE_UI_CANDIDATE_URL" >/dev/null; then break; fi
sleep 1
done
curl --fail --silent --show-error "$MOBILE_UI_CANDIDATE_URL" >/dev/null
curl --fail --silent --show-error \
"$ORIENTATION_SERVER_URL/releases/202608261927-index.html" >/dev/null
MOBILE_UI_RAW_DIR="$SHARD_RAW_DIR" \
node "atman/$ORIENTATION_AUDIT_GENERATION-verify-mobile-ui-browser.mjs" \
| tee "$RUNNER_TEMP/$ORIENTATION_GENERATION-${MOBILE_UI_SHARD_ID}-stdout.json"
test -s "$SHARD_RAW_DIR/run.json"
- name: Upload raw repair shard
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: pipelinenews-mobile-orientation-shard-202608272048-${{ matrix.id }}-${{ github.run_id }}
overwrite: true
path: ${{ env.SHARD_RAW_DIR }}
if-no-files-found: error
retention-days: 30
aggregate-repair-gate:
name: Aggregate 23 records and gate repair
needs: [mobile-ui-shards, compatibility-browser]
if: needs.mobile-ui-shards.result == 'success' && needs.compatibility-browser.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 20
env:
MOBILE_UI_MODE: repair
MOBILE_UI_SOURCE_COMMIT: ${{ github.sha }}
MOBILE_UI_RAW_DIR: work/202608272048-mobile-orientation/mobile-ui/raw
REPORT_DIR: work/202608272048-mobile-orientation/mobile-ui/report
steps:
- name: Checkout exact source
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
ref: ${{ github.sha }}
persist-credentials: false
- name: Configure Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: "22"
- name: Download all six repair shards
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
with:
pattern: pipelinenews-mobile-orientation-shard-202608272048-*-${{ github.run_id }}
path: ${{ env.ORIENTATION_WORK_ROOT }}/incoming-shards
- name: Reconstruct exact 23-record raw closure
shell: bash
run: |
set -euo pipefail
test ! -e "$MOBILE_UI_RAW_DIR"
test ! -e "$REPORT_DIR"
mkdir -p "$MOBILE_UI_RAW_DIR/screenshots" "$REPORT_DIR"
node --input-type=module <<'NODE'
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { copyFile, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
import path from "node:path";
const incomingRoot = path.resolve(process.env.ORIENTATION_WORK_ROOT, "incoming-shards");
const finalRoot = path.resolve(process.env.MOBILE_UI_RAW_DIR);
const auditGeneration = process.env.ORIENTATION_AUDIT_GENERATION;
const candidateGeneration = process.env.ORIENTATION_GENERATION;
const sourceCommit = process.env.GITHUB_SHA;
const planned = new Map([
["candidate-static", { targets: ["candidate"], cells: ["P1", "P2", "L1", "L2", "L3", "L4", "T1"], rotate: false }],
["original-static", { targets: ["original"], cells: ["P1", "P2", "L1", "L2", "L3", "L4", "T1"], rotate: false }],
["baseline-a", { targets: ["baseline"], cells: ["P1", "P2", "L1"], rotate: false }],
["baseline-b", { targets: ["baseline"], cells: ["L2", "L3"], rotate: false }],
["baseline-c", { targets: ["baseline"], cells: ["L4", "T1"], rotate: false }],
["rotations", { targets: ["candidate", "baseline"], cells: [], rotate: true }],
]);
async function walk(directory) {
const files = [];
for (const entry of await readdir(directory, { withFileTypes: true })) {
const filename = path.join(directory, entry.name);
if (entry.isDirectory()) files.push(...await walk(filename));
else if (entry.isFile()) files.push(filename);
else throw new Error(`non-file artifact entry: ${filename}`);
}
return files;
}
const sha256 = (bytes) => createHash("sha256").update(bytes).digest("hex");
const inside = (root, candidate) => {
const relative = path.relative(root, candidate);
return relative !== "" && relative !== ".." && !relative.startsWith(`..${path.sep}`)
&& !path.isAbsolute(relative);
};
const screenshotReferences = (record) => {
const references = [];
const visit = (value) => {
if (!value || typeof value !== "object") return;
if (typeof value.path === "string") {
references.push(value);
return;
}
for (const child of Object.values(value)) visit(child);
};
visit(record.screenshots);
return references;
};
const allFiles = await walk(incomingRoot);
const runPaths = allFiles.filter((filename) => path.basename(filename) === "run.json");
assert.equal(runPaths.length, planned.size, "exactly six shard run records are required");
const records = new Map();
const copiedScreenshots = new Map();
const sourceEnvelopes = [];
const shardSummaries = [];
let commonBrowser = null;
for (const runPath of runPaths) {
const shardRoot = path.dirname(runPath);
const run = JSON.parse(await readFile(runPath, "utf8"));
assert.equal(run.schema, "pipelinenews.mobile-ui-browser-run.v1");
assert.equal(run.generation, auditGeneration);
assert.equal(run.source_commit, sourceCommit);
assert.equal(run.candidate_generation, candidateGeneration);
assert.equal(run.mode, "repair");
assert.equal(run.deployment, "not-authorised");
assert.equal(run.status, "CAPTURED");
assert.deepEqual(run.required_failures, []);
assert.ok(run.shard && planned.has(run.shard.id));
const plan = planned.get(run.shard.id);
assert.deepEqual(run.shard.target_ids, plan.targets);
assert.deepEqual(run.shard.static_cell_ids, plan.cells);
assert.equal(run.shard.include_rotate, plan.rotate);
const expectedCount = plan.targets.length * plan.cells.length + (plan.rotate ? 2 : 0);
assert.equal(run.expected_record_count, expectedCount);
assert.equal(run.records.length, expectedCount);
if (commonBrowser === null) commonBrowser = run.browser;
else assert.deepEqual(run.browser, commonBrowser);
const envelopeBytes = await readFile(path.join(shardRoot, "source-envelope.json"));
const envelope = JSON.parse(envelopeBytes);
assert.equal(envelope.generation, auditGeneration);
assert.equal(envelope.source_commit, sourceCommit);
assert.equal(envelope.github_run_id, process.env.GITHUB_RUN_ID);
assert.equal(envelope.candidate_generation, candidateGeneration);
assert.equal(envelope.comparator_mode, "repair");
sourceEnvelopes.push({ bytes: envelopeBytes, hash: sha256(envelopeBytes) });
for (const filename of run.records) {
assert.equal(filename, path.basename(filename));
const sourcePath = path.resolve(shardRoot, filename);
assert.ok(inside(shardRoot, sourcePath));
const bytes = await readFile(sourcePath);
assert.ok(bytes.length <= 262144);
const record = JSON.parse(bytes);
assert.equal(record.schema, "pipelinenews.mobile-ui-cell-evidence.v1");
assert.equal(record.generation, auditGeneration);
assert.equal(record.source_commit, sourceCommit);
assert.equal(record.mode, "repair");
const key = `${record.target.id}::${record.cell.id}`;
assert.ok(!records.has(key), `duplicate record ${key}`);
records.set(key, filename);
await copyFile(sourcePath, path.join(finalRoot, filename));
for (const reference of screenshotReferences(record)) {
assert.match(reference.path, /^screenshots\/[a-zA-Z0-9._-]+\.jpeg$/u);
const screenshotSource = path.resolve(shardRoot, reference.path);
assert.ok(inside(shardRoot, screenshotSource));
const screenshotBytes = await readFile(screenshotSource);
assert.ok(screenshotBytes.length <= 409600);
assert.equal(screenshotBytes.length, reference.bytes);
assert.equal(sha256(screenshotBytes), reference.sha256);
if (copiedScreenshots.has(reference.path)) {
assert.equal(copiedScreenshots.get(reference.path), reference.sha256);
} else {
copiedScreenshots.set(reference.path, reference.sha256);
const destination = path.join(finalRoot, reference.path);
await mkdir(path.dirname(destination), { recursive: true });
await copyFile(screenshotSource, destination);
}
}
}
shardSummaries.push({
id: run.shard.id,
started_at: run.started_at,
completed_at: run.completed_at,
record_count: run.records.length,
optional_original_unavailable: run.optional_original_unavailable,
});
planned.delete(run.shard.id);
}
assert.equal(planned.size, 0);
assert.ok(sourceEnvelopes.every(({ hash }) => hash === sourceEnvelopes[0].hash));
await writeFile(path.join(finalRoot, "source-envelope.json"), sourceEnvelopes[0].bytes);
const expectedKeys = new Set();
for (const target of ["candidate", "baseline", "original"]) {
for (const cell of ["P1", "P2", "L1", "L2", "L3", "L4", "T1"]) {
expectedKeys.add(`${target}::${cell}`);
}
}
expectedKeys.add("candidate::R1");
expectedKeys.add("baseline::R1");
assert.equal(records.size, 23);
assert.deepEqual([...records.keys()].sort(), [...expectedKeys].sort());
shardSummaries.sort((left, right) => left.id.localeCompare(right.id));
await writeFile(path.join(finalRoot, "run.json"), `${JSON.stringify({
schema: "pipelinenews.mobile-ui-browser-run.v1",
generation: auditGeneration,
project_posture: {
owner: "Ventus Ltd",
application: "non-commercial-open-source",
publisher_redistribution_rights: "source-specific-not-inferred",
},
source_commit: sourceCommit,
candidate_generation: candidateGeneration,
contract_schema: "pipelinenews.mobile-ui-invariants.v1",
mode: "repair",
deployment: "not-authorised",
started_at: shardSummaries.map(({ started_at }) => started_at).sort()[0],
completed_at: shardSummaries.map(({ completed_at }) => completed_at).sort().at(-1),
browser: commonBrowser,
records: [...records.values()].sort(),
expected_record_count: 23,
shards: shardSummaries,
required_failures: [],
optional_original_unavailable: shardSummaries.some(({ optional_original_unavailable }) => optional_original_unavailable),
status: "CAPTURED",
}, null, 2)}\n`);
NODE
- name: Run unchanged 1656 comparator in repair mode
shell: bash
run: |
set -euo pipefail
test "$(sha256sum atman/202608271656-mobile-ui-invariants.mjs | cut -d' ' -f1)" = \
"3dbee93a7de2cc01f9fece3e3318b1f151871231ae254bff9cc67fe4fd69aae2"
test "$(sha256sum atman/202608271656-compare-mobile-ui.mjs | cut -d' ' -f1)" = \
"5fb162b9396db069dcd754c3deddc0bb0287522250265108426e7059ea342147"
node "atman/$ORIENTATION_AUDIT_GENERATION-compare-mobile-ui.mjs" \
| tee "$ORIENTATION_WORK_ROOT/mobile-ui/comparator-stdout.json"
node --input-type=module <<'NODE'
import assert from "node:assert/strict";
import { readFile, writeFile } from "node:fs/promises";
const metrics = JSON.parse(await readFile(`${process.env.REPORT_DIR}/metrics.json`));
assert.equal(metrics.schema, "pipelinenews.mobile-ui-comparison.v1");
assert.equal(metrics.generation, process.env.ORIENTATION_AUDIT_GENERATION);
assert.equal(metrics.candidate_generation, process.env.ORIENTATION_GENERATION);
assert.equal(metrics.source_commit, process.env.GITHUB_SHA);
assert.equal(metrics.mode, "repair");
assert.equal(metrics.contract.sha256, "3dbee93a7de2cc01f9fece3e3318b1f151871231ae254bff9cc67fe4fd69aae2");
assert.equal(metrics.records.length, 23);
assert.equal(metrics.verdict.producer_status, "PASS");
assert.equal(metrics.verdict.candidate_gate.status, "PASS", JSON.stringify(metrics.verdict.candidate_gate.failures));
assert.deepEqual(metrics.verdict.candidate_gate.failures, []);
assert.equal(metrics.observed.I9.R1.candidate, "PASS");
for (const cell of ["P1", "P2", "L1", "L2", "L3", "L4", "T1"]) {
assert.equal(metrics.observed.I7[cell].candidate, "PASS", `safe-area repair failed in ${cell}`);
}
await writeFile(`${process.env.ORIENTATION_WORK_ROOT}/mobile-ui/repair-gate.json`, `${JSON.stringify({
schema: "pipelinenews.mobile-orientation-repair-gate.v1",
generation: process.env.ORIENTATION_GENERATION,
comparator_generation: process.env.ORIENTATION_AUDIT_GENERATION,
comparator_contract_sha256: metrics.contract.sha256,
aggregate_records: metrics.records.length,
candidate_checks: metrics.verdict.candidate_gate.checks,
candidate_gate: metrics.verdict.candidate_gate.status,
rotation_node_stability: metrics.observed.I9.R1.candidate,
safe_area_cells: ["P1", "P2", "L1", "L2", "L3", "L4", "T1"],
deployment: "not-authorised",
status: "PASS",
}, null, 2)}\n`);
NODE
- name: Enforce bounded repair evidence
shell: bash
run: |
set -euo pipefail
test "$(du -sb "$MOBILE_UI_RAW_DIR" | cut -f1)" -lt 26214400
test "$(du -sb "$REPORT_DIR" | cut -f1)" -lt 1572864
test "$(find "$MOBILE_UI_RAW_DIR" -maxdepth 1 -name '*--*.json' | wc -l)" -eq 23
- name: Upload complete repair gate
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: pipelinenews-mobile-orientation-repair-gate-202608272048-${{ github.run_id }}
overwrite: true
path: ${{ env.ORIENTATION_WORK_ROOT }}/mobile-ui
if-no-files-found: error
retention-days: 30
commit-candidate:
name: Commit immutable quarantine candidate
needs: [build, compatibility-browser, aggregate-repair-gate]
if: needs.build.result == 'success' && needs.compatibility-browser.result == 'success' && needs.aggregate-repair-gate.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- name: Checkout exact verified source
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09
with:
ref: ${{ github.sha }}
fetch-depth: 0
persist-credentials: false
- name: Download verified immutable closure
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0
with:
name: pipelinenews-mobile-orientation-closure-202608272048-${{ github.run_id }}
path: ${{ env.ORIENTATION_WORK_ROOT }}/verified
- name: Prepare idempotent five-file publication
id: prepare-publication
shell: bash
run: |
set -euo pipefail
source_commit="$GITHUB_SHA"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin main
remote_main="$(git rev-parse origin/main)"
git checkout -B main "$source_commit"
test ! -e "build/$ORIENTATION_GENERATION-v8-fast-site-manifest.json"
test ! -e "releases/$ORIENTATION_GENERATION-v8-fast-candidate.html"
test ! -e "releases/javascript/$ORIENTATION_GENERATION-v8-fast-runtime.js"
test ! -e "releases/data/$ORIENTATION_GENERATION-v8-fast-registry.json"
test ! -e "releases/styles/$ORIENTATION_GENERATION-orientation.css"
node --input-type=module <<'NODE'
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { constants } from "node:fs";
import { copyFile, lstat, mkdir, readFile, readdir } from "node:fs/promises";
import path from "node:path";
const incoming = path.resolve(process.env.ORIENTATION_WORK_ROOT, "verified");
const generation = process.env.ORIENTATION_GENERATION;
const manifestPath = `build/${generation}-v8-fast-site-manifest.json`;
const manifest = JSON.parse(await readFile(path.join(incoming, manifestPath)));
assert.equal(manifest.generation, generation);
assert.equal(manifest.source_commit, process.env.GITHUB_SHA);
assert.equal(manifest.github_run_id, process.env.GITHUB_RUN_ID);
assert.equal(manifest.deployment, "not-authorised");
const inputPaths = new Set();
for (const record of manifest.inputs) {
assert.deepEqual(Object.keys(record).sort(), ["bytes", "path", "sha256"]);
assert.ok(!inputPaths.has(record.path), `duplicate manifest input ${record.path}`);
inputPaths.add(record.path);
const filename = path.resolve(record.path);
assert.ok(filename.startsWith(`${process.cwd()}${path.sep}`), `manifest input escapes repository: ${record.path}`);
const stat = await lstat(filename);
assert.ok(stat.isFile() && !stat.isSymbolicLink(), `manifest input is not a regular file: ${record.path}`);
const bytes = await readFile(filename);
assert.equal(bytes.length, record.bytes, `manifest input byte drift: ${record.path}`);
assert.equal(
createHash("sha256").update(bytes).digest("hex"),
record.sha256,
`manifest input hash drift: ${record.path}`,
);
}
const expected = [manifestPath, ...manifest.outputs.map(({ path: relative }) => relative)].sort();
assert.equal(expected.length, 5);
async function walk(directory, base = directory) {
const result = [];
for (const entry of await readdir(directory, { withFileTypes: true })) {
const filename = path.join(directory, entry.name);
if (entry.isDirectory()) result.push(...await walk(filename, base));
else result.push(path.relative(base, filename).split(path.sep).join("/"));
}
return result.sort();
}
assert.deepEqual(await walk(incoming), expected);
for (const relative of expected) {
const target = path.resolve(relative);
assert.ok(target.startsWith(`${process.cwd()}${path.sep}`));
await mkdir(path.dirname(target), { recursive: true });
await copyFile(path.join(incoming, relative), target, constants.COPYFILE_EXCL);
}
NODE
git add \
"build/$ORIENTATION_GENERATION-v8-fast-site-manifest.json" \
"releases/$ORIENTATION_GENERATION-v8-fast-candidate.html" \
"releases/javascript/$ORIENTATION_GENERATION-v8-fast-runtime.js" \
"releases/data/$ORIENTATION_GENERATION-v8-fast-registry.json" \
"releases/styles/$ORIENTATION_GENERATION-orientation.css"
test "$(git diff --cached --name-only | wc -l)" -eq 5
diff -u <(printf '%s\n' \
"build/$ORIENTATION_GENERATION-v8-fast-site-manifest.json" \
"releases/$ORIENTATION_GENERATION-v8-fast-candidate.html" \
"releases/data/$ORIENTATION_GENERATION-v8-fast-registry.json" \
"releases/javascript/$ORIENTATION_GENERATION-v8-fast-runtime.js" \
"releases/styles/$ORIENTATION_GENERATION-orientation.css" | LC_ALL=C sort) \
<(git diff --cached --name-only | LC_ALL=C sort)
if test "$remote_main" != "$source_commit"; then
test "$(git rev-list --parents -n 1 "$remote_main" | wc -w)" -eq 2
test "$(git rev-parse "$remote_main^")" = "$source_commit"
diff -u <(git diff --name-only "$source_commit" "$remote_main" | LC_ALL=C sort) \
<(git diff --cached --name-only | LC_ALL=C sort)
while IFS= read -r relative; do
test "$(git hash-object "$ORIENTATION_WORK_ROOT/verified/$relative")" = \
"$(git rev-parse "$remote_main:$relative")"
done < <(git diff --cached --name-only | LC_ALL=C sort)
test "$(git write-tree)" = "$(git rev-parse "$remote_main^{tree}")"
echo "mode=existing" >> "$GITHUB_OUTPUT"
echo "commit_sha=$remote_main" >> "$GITHUB_OUTPUT"
exit 0
fi
git commit -m "v8: build mobile orientation candidate $ORIENTATION_GENERATION"
test "$(git rev-parse HEAD^)" = "$source_commit"
echo "mode=new" >> "$GITHUB_OUTPUT"
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: CAS push new immutable candidate
if: steps.prepare-publication.outputs.mode == 'new'
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
source_commit="$GITHUB_SHA"
output_commit="${{ steps.prepare-publication.outputs.commit_sha }}"
git fetch origin main
test "$(git rev-parse origin/main)" = "$source_commit"
test "$(git rev-parse "$output_commit^")" = "$source_commit"
auth_header="$(printf 'x-access-token:%s' "$GITHUB_TOKEN" | base64 -w0)"
git -c "http.https://github.com/.extraheader=AUTHORIZATION: basic $auth_header" \
push "https://github.com/$GITHUB_REPOSITORY.git" \
"$output_commit:refs/heads/main"