@rightkit/ci 0.0.0-stage → 0.2.43
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/README.md +177 -2
- package/adopt.mjs +96 -0
- package/checkout.mjs +93 -0
- package/checkout.test.mjs +91 -0
- package/cli/right-git.mjs +218 -0
- package/cli.test.mjs +68 -0
- package/drift.mjs +201 -0
- package/drift.test.mjs +203 -0
- package/guard-coverage.test.mjs +236 -0
- package/install.mjs +81 -0
- package/manifest.mjs +1862 -0
- package/manifest.schema.json +286 -0
- package/manifest.test.mjs +487 -0
- package/ownership-registration.mjs +33 -0
- package/ownership-registration.test.mjs +20 -0
- package/pack-smoke.test.mjs +55 -0
- package/package.json +38 -4
- package/pnpm-lock-patch.test.mjs +161 -0
- package/policy/visibility-gate.mjs +168 -0
- package/render.mjs +69 -0
- package/render.test.mjs +1722 -0
- package/rightkit-ownership.json +15 -0
- package/sync.mjs +180 -0
- package/sync.test.mjs +147 -0
- package/templates/ci.yml +50 -0
- package/templates/package-smoke.yml +38 -0
- package/templates/profiles/rust-hybrid/ci.yml +127 -0
- package/templates/profiles/rust-hybrid/regenerate.yml +96 -0
- package/templates/profiles/rust-hybrid/release-candidate.yml +193 -0
- package/templates/publish-npm.yml +72 -0
- package/templates/publish-package-managers.yml +158 -0
- package/templates/qualification.yml +94 -0
- package/templates/regenerate.yml +80 -0
- package/templates/release-candidate.yml +57 -0
- package/test-support.mjs +34 -0
- package/uninstall.mjs +36 -0
- package/uninstall.test.mjs +89 -0
- package/visibility-gate.test.mjs +141 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Managed by right-git — do not hand-edit. Run `right-git sync` to update.
|
|
2
|
+
# Template: profiles/rust-hybrid/release-candidate.yml | Template version: ${TEMPLATE_VERSION}
|
|
3
|
+
# Dispatch-only release chain binds every stage to one admitted main revision.
|
|
4
|
+
name: release-candidate
|
|
5
|
+
on:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
version:
|
|
9
|
+
description: Stable SemVer to qualify or publish
|
|
10
|
+
required: true
|
|
11
|
+
type: string
|
|
12
|
+
source_revision:
|
|
13
|
+
description: Exact 40-character lowercase main commit SHA
|
|
14
|
+
required: true
|
|
15
|
+
type: string
|
|
16
|
+
signed_qualification:
|
|
17
|
+
description: Run protected signing, installed qualification, & evidence verification
|
|
18
|
+
required: false
|
|
19
|
+
type: boolean
|
|
20
|
+
default: false
|
|
21
|
+
publish:
|
|
22
|
+
description: Publish only after same-run signed qualification verifies
|
|
23
|
+
required: false
|
|
24
|
+
type: boolean
|
|
25
|
+
default: false
|
|
26
|
+
dry_run:
|
|
27
|
+
description: Rehearse packaging, signing & installed qualification from a branch with publication skipped
|
|
28
|
+
required: false
|
|
29
|
+
type: boolean
|
|
30
|
+
default: false
|
|
31
|
+
concurrency:
|
|
32
|
+
group: release-${{ inputs.version }}
|
|
33
|
+
cancel-in-progress: false
|
|
34
|
+
permissions:
|
|
35
|
+
contents: read
|
|
36
|
+
jobs:
|
|
37
|
+
private-repo-guard:
|
|
38
|
+
runs-on: ubuntu-24.04
|
|
39
|
+
steps:
|
|
40
|
+
- name: Refuse private repository
|
|
41
|
+
if: ${{ github.event.repository.private }}
|
|
42
|
+
run: exit 1
|
|
43
|
+
admission:
|
|
44
|
+
needs: [private-repo-guard]
|
|
45
|
+
runs-on: ubuntu-24.04
|
|
46
|
+
permissions:
|
|
47
|
+
contents: read
|
|
48
|
+
outputs:
|
|
49
|
+
version: ${{ steps.admit.outputs.version }}
|
|
50
|
+
source_revision: ${{ steps.admit.outputs.source_revision }}
|
|
51
|
+
signed_qualification: ${{ steps.admit.outputs.signed_qualification }}
|
|
52
|
+
publish: ${{ steps.admit.outputs.publish }}
|
|
53
|
+
dry_run: ${{ steps.admit.outputs.dry_run }}
|
|
54
|
+
artifact_suffix: ${{ steps.admit.outputs.artifact_suffix }}
|
|
55
|
+
steps:
|
|
56
|
+
- name: Validate immutable dispatch envelope
|
|
57
|
+
shell: bash
|
|
58
|
+
run: |
|
|
59
|
+
set -euo pipefail
|
|
60
|
+
if [[ "${{ inputs.dry_run }}" == "true" ]]; then
|
|
61
|
+
[[ "$GITHUB_REF" == refs/heads/* ]]
|
|
62
|
+
[[ "${{ inputs.publish }}" != "true" ]]
|
|
63
|
+
else
|
|
64
|
+
[[ "$GITHUB_REF" == "refs/heads/${DEFAULT_BRANCH}" ]]
|
|
65
|
+
[[ "$GITHUB_RUN_ATTEMPT" == "1" ]]
|
|
66
|
+
fi
|
|
67
|
+
[[ "${{ inputs.version }}" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]
|
|
68
|
+
[[ "${{ inputs.source_revision }}" =~ ^[a-f0-9]{40}$ ]]
|
|
69
|
+
if [[ "${{ inputs.publish }}" == "true" ]]; then [[ "${{ inputs.signed_qualification }}" == "true" ]]; fi
|
|
70
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
71
|
+
with:
|
|
72
|
+
ref: ${{ inputs.source_revision }}
|
|
73
|
+
fetch-depth: 0
|
|
74
|
+
persist-credentials: false
|
|
75
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
76
|
+
with:
|
|
77
|
+
node-version: ${NODE_PUBLISH_VERSION}
|
|
78
|
+
package-manager-cache: false
|
|
79
|
+
${PACKAGE_MANAGER_SETUP}
|
|
80
|
+
- run: ${INSTALL_COMMAND}
|
|
81
|
+
${OWNERSHIP_STEP}
|
|
82
|
+
- name: Admit exact main revision & version
|
|
83
|
+
id: admit
|
|
84
|
+
run: ${PM_RUN} ${RELEASE_ADMISSION_SCRIPT}
|
|
85
|
+
env:
|
|
86
|
+
GH_TOKEN: ${{ github.token }}
|
|
87
|
+
RIGHT_GIT_RELEASE_VERSION: ${{ inputs.version }}
|
|
88
|
+
RIGHT_GIT_SOURCE_REVISION: ${{ inputs.source_revision }}
|
|
89
|
+
RIGHT_GIT_SIGNED_QUALIFICATION: ${{ inputs.signed_qualification }}
|
|
90
|
+
RIGHT_GIT_PUBLISH: ${{ inputs.publish }}
|
|
91
|
+
RIGHT_GIT_DRY_RUN: ${{ inputs.dry_run }}
|
|
92
|
+
RIGHT_GIT_WORKFLOW_REF: ${{ github.ref }}
|
|
93
|
+
RIGHT_GIT_RUN_ATTEMPT: ${{ github.run_attempt }}
|
|
94
|
+
candidate:
|
|
95
|
+
needs: [admission]
|
|
96
|
+
env:
|
|
97
|
+
SCCACHE_GHA_ENABLED: "true"
|
|
98
|
+
RUSTC_WRAPPER: "sccache"
|
|
99
|
+
strategy:
|
|
100
|
+
fail-fast: false
|
|
101
|
+
matrix:
|
|
102
|
+
${CANDIDATE_MATRIX}
|
|
103
|
+
runs-on: ${{ matrix.os }}
|
|
104
|
+
steps:
|
|
105
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
106
|
+
with:
|
|
107
|
+
ref: ${{ needs.admission.outputs.source_revision }}
|
|
108
|
+
fetch-depth: 0
|
|
109
|
+
persist-credentials: false
|
|
110
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
111
|
+
with:
|
|
112
|
+
node-version: ${{ matrix.node }}
|
|
113
|
+
package-manager-cache: false
|
|
114
|
+
${PACKAGE_MANAGER_SETUP}
|
|
115
|
+
- uses: dtolnay/rust-toolchain@f8be11a05b1d4f3fcebe6410cc16743212b999b0
|
|
116
|
+
with:
|
|
117
|
+
components: rustfmt, clippy
|
|
118
|
+
targets: ${{ matrix.targetTriple }}
|
|
119
|
+
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
|
120
|
+
with:
|
|
121
|
+
workspaces: |
|
|
122
|
+
${RUST_CACHE_WORKSPACES}
|
|
123
|
+
shared-key: ${ARTIFACT_PREFIX}-rust
|
|
124
|
+
add-job-id-key: false
|
|
125
|
+
${RUST_CACHE_KEY} cache-workspace-crates: false
|
|
126
|
+
cache-on-failure: true
|
|
127
|
+
save-if: true
|
|
128
|
+
- uses: Mozilla-Actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11
|
|
129
|
+
with:
|
|
130
|
+
version: "v0.16.0"
|
|
131
|
+
- run: ${INSTALL_COMMAND}
|
|
132
|
+
- name: Initialize candidate stage summary
|
|
133
|
+
run: ${PM_RUN} ${RELEASE_STAGE_SUMMARY_SCRIPT}
|
|
134
|
+
env:
|
|
135
|
+
RIGHT_GIT_STAGE_ACTION: init
|
|
136
|
+
RIGHT_GIT_STAGE_ROOT: ${{ runner.temp }}/right-git-stage-summary
|
|
137
|
+
RIGHT_GIT_STAGE_EVIDENCE_ROOT: ${{ runner.temp }}/${CANDIDATE_ARTIFACT_ROOT}
|
|
138
|
+
RIGHT_GIT_STAGE: candidate
|
|
139
|
+
RIGHT_GIT_STAGE_PRODUCER: candidate-${{ matrix.platform }}-${{ matrix.architecture }}
|
|
140
|
+
RIGHT_GIT_RELEASE_VERSION: ${{ needs.admission.outputs.version }}
|
|
141
|
+
RIGHT_GIT_SOURCE_REVISION: ${{ needs.admission.outputs.source_revision }}
|
|
142
|
+
RIGHT_GIT_RELEASE_PLATFORM: ${{ matrix.platform }}
|
|
143
|
+
RIGHT_GIT_RELEASE_ARCHITECTURE: ${{ matrix.architecture }}
|
|
144
|
+
RIGHT_GIT_RUN_ID: ${{ github.run_id }}
|
|
145
|
+
RIGHT_GIT_RUN_ATTEMPT: ${{ github.run_attempt }}${SWIFT_PRIVATE_CONFIGURE_STEP}
|
|
146
|
+
- name: Build unsigned release candidate
|
|
147
|
+
run: ${PM_RUN} ${CANDIDATE_BUILD_SCRIPT}
|
|
148
|
+
env:
|
|
149
|
+
RIGHT_GIT_ARTIFACT_ROOT: ${{ runner.temp }}/${CANDIDATE_ARTIFACT_ROOT}
|
|
150
|
+
RIGHT_GIT_RELEASE_PLATFORM: ${{ matrix.platform }}
|
|
151
|
+
RIGHT_GIT_RELEASE_ARCHITECTURE: ${{ matrix.architecture }}
|
|
152
|
+
RIGHT_GIT_SOURCE_REVISION: ${{ needs.admission.outputs.source_revision }}
|
|
153
|
+
- name: Check unsigned release candidate
|
|
154
|
+
run: ${PM_RUN} ${CANDIDATE_CHECK_SCRIPT}
|
|
155
|
+
env:
|
|
156
|
+
RIGHT_GIT_ARTIFACT_ROOT: ${{ runner.temp }}/${CANDIDATE_ARTIFACT_ROOT}
|
|
157
|
+
RIGHT_GIT_RELEASE_PLATFORM: ${{ matrix.platform }}
|
|
158
|
+
RIGHT_GIT_RELEASE_ARCHITECTURE: ${{ matrix.architecture }}
|
|
159
|
+
RIGHT_GIT_SOURCE_REVISION: ${{ needs.admission.outputs.source_revision }}${SWIFT_PRIVATE_CLEANUP_STEP}
|
|
160
|
+
- name: Finalize candidate stage summary
|
|
161
|
+
if: ${{ always() }}
|
|
162
|
+
run: ${PM_RUN} ${RELEASE_STAGE_SUMMARY_SCRIPT}
|
|
163
|
+
env:
|
|
164
|
+
RIGHT_GIT_STAGE_ACTION: finalize
|
|
165
|
+
RIGHT_GIT_STAGE_ROOT: ${{ runner.temp }}/right-git-stage-summary
|
|
166
|
+
RIGHT_GIT_STAGE_EVIDENCE_ROOT: ${{ runner.temp }}/${CANDIDATE_ARTIFACT_ROOT}
|
|
167
|
+
RIGHT_GIT_STAGE: candidate
|
|
168
|
+
RIGHT_GIT_STAGE_PRODUCER: candidate-${{ matrix.platform }}-${{ matrix.architecture }}
|
|
169
|
+
RIGHT_GIT_STAGE_STATUS: ${{ job.status == 'success' && 'SUCCEEDED' || 'FAILED' }}
|
|
170
|
+
RIGHT_GIT_STAGE_EXIT_CODE: ${{ job.status == 'success' && '0' || '1' }}
|
|
171
|
+
RIGHT_GIT_RELEASE_VERSION: ${{ needs.admission.outputs.version }}
|
|
172
|
+
RIGHT_GIT_SOURCE_REVISION: ${{ needs.admission.outputs.source_revision }}
|
|
173
|
+
RIGHT_GIT_RELEASE_PLATFORM: ${{ matrix.platform }}
|
|
174
|
+
RIGHT_GIT_RELEASE_ARCHITECTURE: ${{ matrix.architecture }}
|
|
175
|
+
RIGHT_GIT_RUN_ID: ${{ github.run_id }}
|
|
176
|
+
RIGHT_GIT_RUN_ATTEMPT: ${{ github.run_attempt }}
|
|
177
|
+
- name: Upload unsigned candidate handoff
|
|
178
|
+
if: ${{ always() }}
|
|
179
|
+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
180
|
+
with:
|
|
181
|
+
name: ${ARTIFACT_PREFIX}-${{ github.run_id }}-${{ github.run_attempt }}-candidate-${{ matrix.platform }}-${{ matrix.architecture }}-${{ needs.admission.outputs.version }}-${{ needs.admission.outputs.source_revision }}${{ needs.admission.outputs.artifact_suffix }}
|
|
182
|
+
path: ${{ runner.temp }}/${CANDIDATE_ARTIFACT_ROOT}/**
|
|
183
|
+
if-no-files-found: error
|
|
184
|
+
- name: Upload candidate stage summary
|
|
185
|
+
if: ${{ always() }}
|
|
186
|
+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
187
|
+
with:
|
|
188
|
+
name: ${ARTIFACT_PREFIX}-${{ github.run_id }}-${{ github.run_attempt }}-summary-candidate-${{ matrix.platform }}-${{ matrix.architecture }}-${{ needs.admission.outputs.version }}-${{ needs.admission.outputs.source_revision }}${{ needs.admission.outputs.artifact_suffix }}
|
|
189
|
+
path: ${{ runner.temp }}/right-git-stage-summary/stage-summary.json
|
|
190
|
+
if-no-files-found: error
|
|
191
|
+
${WINDOWS_SIGNING_JOB}
|
|
192
|
+
${MACOS_SIGNING_JOB}
|
|
193
|
+
${RELEASE_CHAIN_JOBS}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Managed by right-git — do not hand-edit. Run `right-git sync` to update.
|
|
2
|
+
# Template: publish-npm.yml | Template version: ${TEMPLATE_VERSION}
|
|
3
|
+
# OIDC trusted publishing is the sole publish credential —
|
|
4
|
+
# no long-lived npm token, no signing material (invariant I2). Runs after
|
|
5
|
+
# right-release has already built/signed/notarized locally and attached
|
|
6
|
+
# artifacts to the GitHub Release (DESIGN.md §7); this job publishes the
|
|
7
|
+
# source npm package itself.
|
|
8
|
+
name: publish-npm
|
|
9
|
+
on:
|
|
10
|
+
release:
|
|
11
|
+
types: [published]
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
# F5 fix: see ci.yml for why the guard is its own always-runs job rather
|
|
15
|
+
# than a job-level `if: !private` (which only skipped instead of failing).
|
|
16
|
+
jobs:
|
|
17
|
+
private-repo-guard:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- name: Refuse private repository
|
|
21
|
+
if: ${{ github.event.repository.private }}
|
|
22
|
+
run: |
|
|
23
|
+
echo "::error::right-git: repository is private; managed public-only workflows must not run here."
|
|
24
|
+
exit 1
|
|
25
|
+
publish-npm:
|
|
26
|
+
needs: [private-repo-guard]
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
environment: release
|
|
29
|
+
permissions:
|
|
30
|
+
contents: read
|
|
31
|
+
id-token: write
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v5
|
|
34
|
+
with:
|
|
35
|
+
ref: ${{ github.event.release.tag_name }}
|
|
36
|
+
- uses: actions/setup-node@v5
|
|
37
|
+
with:
|
|
38
|
+
node-version: ${NODE_PUBLISH_VERSION}
|
|
39
|
+
registry-url: https://registry.npmjs.org
|
|
40
|
+
package-manager-cache: false
|
|
41
|
+
${PACKAGE_MANAGER_SETUP}
|
|
42
|
+
- run: ${INSTALL_COMMAND}
|
|
43
|
+
${OWNERSHIP_STEP}
|
|
44
|
+
- run: node scripts/release/build-candidate.mjs --version "${{ github.event.release.tag_name }}" --platform current --out "release/candidates/publish"
|
|
45
|
+
- run: node scripts/release/check-release.mjs release/candidates/publish
|
|
46
|
+
# check-release must supply publication-evidence.json with artifactSha256.
|
|
47
|
+
# Capture gated bytes before publication; never hash the source path during readback.
|
|
48
|
+
- id: tarball
|
|
49
|
+
shell: bash
|
|
50
|
+
run: |
|
|
51
|
+
node --input-type=module <<'NODE'
|
|
52
|
+
import fs from 'node:fs';
|
|
53
|
+
import { prepareNpmPublication } from '@rightkit/release/publication-gate.mjs';
|
|
54
|
+
const root = 'release/candidates/publish';
|
|
55
|
+
const c = JSON.parse(fs.readFileSync(`${root}/compatibility.json`));
|
|
56
|
+
const tarball = `${root}/${c.packageName.replace(/^@/, '').replace('/', '-')}-${c.version}.tgz`;
|
|
57
|
+
const proof = prepareNpmPublication({ name: c.packageName, version: c.version, tarball, evidencePath: `${root}/publication-evidence.json` });
|
|
58
|
+
// Only safe single-line metadata may enter GitHub outputs.
|
|
59
|
+
for (const value of [tarball, proof.name, proof.version]) if (/[\r\n]/.test(value)) throw new Error('unsafe npm publication identity');
|
|
60
|
+
fs.appendFileSync(process.env.GITHUB_OUTPUT, `path=${tarball}\nname=${proof.name}\nversion=${proof.version}\nsha1=${proof.sha1}\n`);
|
|
61
|
+
NODE
|
|
62
|
+
- run: npm publish "${{ steps.tarball.outputs.path }}"${NPM_PROVENANCE_FLAG} --access public
|
|
63
|
+
- name: Require registry byte equality
|
|
64
|
+
env:
|
|
65
|
+
NPM_PUBLICATION_NAME: ${{ steps.tarball.outputs.name }}
|
|
66
|
+
NPM_PUBLICATION_VERSION: ${{ steps.tarball.outputs.version }}
|
|
67
|
+
NPM_PUBLICATION_SHA1: ${{ steps.tarball.outputs.sha1 }}
|
|
68
|
+
run: |
|
|
69
|
+
node --input-type=module <<'NODE'
|
|
70
|
+
import { verifyNpmRegistryBytes } from '@rightkit/release/publication-gate.mjs';
|
|
71
|
+
verifyNpmRegistryBytes({ name: process.env.NPM_PUBLICATION_NAME, version: process.env.NPM_PUBLICATION_VERSION, sha1: process.env.NPM_PUBLICATION_SHA1 });
|
|
72
|
+
NODE
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Managed by right-git — do not hand-edit. Run `right-git sync` to update.
|
|
2
|
+
# Template: publish-package-managers.yml | Template version: ${TEMPLATE_VERSION}
|
|
3
|
+
# Adapted from Cortex's publish-package-managers.yml (DESIGN.md §6). Consumes
|
|
4
|
+
# artifacts already signed locally by right-release and attached to the
|
|
5
|
+
# GitHub Release — never signs anything here. Invariant I2 ("no signing
|
|
6
|
+
# credential is ever configured in Actions") is about *signing* material —
|
|
7
|
+
# Apple/Azure/update-key credentials — and holds here: nothing in this file
|
|
8
|
+
# signs, notarizes, or handles code-signing key material.
|
|
9
|
+
#
|
|
10
|
+
# CREDENTIAL BOUNDARY (read before enabling this lane): this is the one lane
|
|
11
|
+
# in right-git that configures long-lived repository secrets, and it is
|
|
12
|
+
# opt-in only — it is rendered only when a repo's .rightgit.json explicitly
|
|
13
|
+
# lists the 'publish-package-managers' lane, and `right-git install`/
|
|
14
|
+
# `validateManifest` (manifest.mjs) refuse that lane unless both
|
|
15
|
+
# publish.homebrew and publish.winget are supplied (--homebrew-tap,
|
|
16
|
+
# --homebrew-formula, --winget-id). No repo gets these secrets by default.
|
|
17
|
+
# - HOMEBREW_TAP_TOKEN: a GitHub PAT with write access to the Homebrew tap
|
|
18
|
+
# repo (${HOMEBREW_TAP}), used only to check out that repo and open a
|
|
19
|
+
# formula-update pull request. Scoped to one tap repo, not the org; the
|
|
20
|
+
# repo owner creates and stores it, right-git never generates it.
|
|
21
|
+
# - WINGET_CREATE_GITHUB_TOKEN: a classic PAT with `public_repo` scope,
|
|
22
|
+
# passed to `wingetcreate` only via env, used only to submit a manifest
|
|
23
|
+
# PR to microsoft/winget-pkgs when the manual `submit: true` dispatch
|
|
24
|
+
# input is set.
|
|
25
|
+
# Both are package-manager PR-submission tokens, not signing credentials —
|
|
26
|
+
# narrower than an npm publish token, but still long-lived secrets, which is
|
|
27
|
+
# why this lane (unlike every other right-git lane) requires explicit,
|
|
28
|
+
# per-target configuration rather than being available by just naming it.
|
|
29
|
+
#
|
|
30
|
+
# Trust-posture note (do not overstate): this lane's `secrets.*` posture
|
|
31
|
+
# differs from publish-npm.yml's, which is OIDC-only and stores no
|
|
32
|
+
# long-lived token at all. HOMEBREW_TAP_TOKEN and WINGET_CREATE_GITHUB_TOKEN
|
|
33
|
+
# ARE real, owner-provisioned, long-lived GitHub tokens sitting in this
|
|
34
|
+
# repo's Actions secrets for as long as the lane stays enabled. Invariant I1
|
|
35
|
+
# (right-git installs into public repos only) makes that exposure
|
|
36
|
+
# public-repo-scoped, never private-repo-scoped — but "public-repo-scoped"
|
|
37
|
+
# is a narrower blast radius, not zero, and is a materially different trust
|
|
38
|
+
# posture from "no credential in secrets.* at all."
|
|
39
|
+
#
|
|
40
|
+
# WinGet stays fail-closed on a missing token and defaults to validate-only;
|
|
41
|
+
# a real microsoft/winget-pkgs PR requires the manual `submit: true` dispatch
|
|
42
|
+
# input (OD-4 in DESIGN.md is left open — this preserves Cortex's existing
|
|
43
|
+
# reviewed-by-default behavior rather than picking a side).
|
|
44
|
+
name: publish-package-managers
|
|
45
|
+
on:
|
|
46
|
+
workflow_dispatch:
|
|
47
|
+
inputs:
|
|
48
|
+
submit:
|
|
49
|
+
description: 'Submit WinGet PR to microsoft/winget-pkgs (true) or validate/output-only (false)'
|
|
50
|
+
required: false
|
|
51
|
+
default: 'false'
|
|
52
|
+
release:
|
|
53
|
+
types: [published]
|
|
54
|
+
permissions:
|
|
55
|
+
contents: read
|
|
56
|
+
# F5 fix: see ci.yml for why the guard is its own always-runs job rather
|
|
57
|
+
# than a job-level `if: !private` (which only skipped instead of failing).
|
|
58
|
+
# Both root jobs below (`homebrew`, `winget-token`) depend on it, so
|
|
59
|
+
# `winget` (which itself only depends on `winget-token`) is guarded
|
|
60
|
+
# transitively too.
|
|
61
|
+
jobs:
|
|
62
|
+
private-repo-guard:
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
steps:
|
|
65
|
+
- name: Refuse private repository
|
|
66
|
+
if: ${{ github.event.repository.private }}
|
|
67
|
+
run: |
|
|
68
|
+
echo "::error::right-git: repository is private; managed public-only workflows must not run here."
|
|
69
|
+
exit 1
|
|
70
|
+
homebrew:
|
|
71
|
+
needs: [private-repo-guard]
|
|
72
|
+
runs-on: ubuntu-latest
|
|
73
|
+
environment: release
|
|
74
|
+
steps:
|
|
75
|
+
- uses: actions/checkout@v5
|
|
76
|
+
- uses: actions/setup-node@v5
|
|
77
|
+
with:
|
|
78
|
+
node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
|
|
79
|
+
package-manager-cache: false
|
|
80
|
+
${PACKAGE_MANAGER_SETUP}
|
|
81
|
+
- run: ${INSTALL_COMMAND}
|
|
82
|
+
${OWNERSHIP_STEP}
|
|
83
|
+
- run: ruby -c release/homebrew/${HOMEBREW_FORMULA_NAME}.rb
|
|
84
|
+
- name: Checkout Homebrew tap
|
|
85
|
+
uses: actions/checkout@v5
|
|
86
|
+
with:
|
|
87
|
+
repository: ${HOMEBREW_TAP}
|
|
88
|
+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
|
89
|
+
path: homebrew-tap
|
|
90
|
+
- run: |
|
|
91
|
+
mkdir -p homebrew-tap/Formula
|
|
92
|
+
cp release/homebrew/${HOMEBREW_FORMULA_NAME}.rb homebrew-tap/Formula/${HOMEBREW_FORMULA_NAME}.rb
|
|
93
|
+
# Downstream PR only — never rewrites an existing release.
|
|
94
|
+
- name: Open Homebrew tap PR
|
|
95
|
+
uses: peter-evans/create-pull-request@v6
|
|
96
|
+
with:
|
|
97
|
+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
|
98
|
+
path: homebrew-tap
|
|
99
|
+
branch: ${HOMEBREW_FORMULA_NAME}-${{ github.ref_name }}
|
|
100
|
+
title: "${HOMEBREW_FORMULA_NAME} ${{ github.ref_name }}"
|
|
101
|
+
delete-branch: true
|
|
102
|
+
|
|
103
|
+
# WinGet is fail-closed: no token, no job. The token is a classic PAT with
|
|
104
|
+
# public_repo scope, created by the repo owner as WINGET_CREATE_GITHUB_TOKEN,
|
|
105
|
+
# and is only ever passed to wingetcreate via env.
|
|
106
|
+
#
|
|
107
|
+
# F5 fix: this job depends on `private-repo-guard` rather than relying on
|
|
108
|
+
# `winget` (below) alone. It has no other `needs`, so without this
|
|
109
|
+
# dependency it would run unconditionally regardless of repository
|
|
110
|
+
# visibility — the probe step always exits 0, so a repo flipped private
|
|
111
|
+
# after install could still satisfy `winget`'s `needs.winget-token` success
|
|
112
|
+
# requirement and let `winget` run its real work in a private repo.
|
|
113
|
+
winget-token:
|
|
114
|
+
needs: [private-repo-guard]
|
|
115
|
+
runs-on: ubuntu-latest
|
|
116
|
+
environment: release
|
|
117
|
+
outputs:
|
|
118
|
+
available: ${{ steps.probe.outputs.available }}
|
|
119
|
+
steps:
|
|
120
|
+
- id: probe
|
|
121
|
+
env:
|
|
122
|
+
TOKEN: ${{ secrets.WINGET_CREATE_GITHUB_TOKEN }}
|
|
123
|
+
run: echo "available=${TOKEN:+true}" >> "$GITHUB_OUTPUT"
|
|
124
|
+
|
|
125
|
+
winget:
|
|
126
|
+
needs: [winget-token]
|
|
127
|
+
runs-on: windows-latest
|
|
128
|
+
environment: release
|
|
129
|
+
if: ${{ needs.winget-token.outputs.available == 'true' }}
|
|
130
|
+
steps:
|
|
131
|
+
- uses: actions/checkout@v5
|
|
132
|
+
- name: Install wingetcreate
|
|
133
|
+
run: dotnet tool install --global Microsoft.WingetCreate
|
|
134
|
+
- name: Validate WinGet manifests (output-only)
|
|
135
|
+
shell: pwsh
|
|
136
|
+
run: |
|
|
137
|
+
$catalog = Get-Content -Raw release/catalog.json | ConvertFrom-Json
|
|
138
|
+
$installer = $catalog.artifacts | Where-Object { $_.name -like '*-Setup.exe' } | Select-Object -First 1
|
|
139
|
+
if (-not $installer) { throw 'release/catalog.json missing a *-Setup.exe installer artifact' }
|
|
140
|
+
$version = [string]$catalog.version
|
|
141
|
+
if ($version -notmatch '^\d+\.\d+\.\d+') { throw "unresolved catalog version: $version" }
|
|
142
|
+
$url = "https://github.com/${{ github.repository }}/releases/download/v$version/$($installer.name)"
|
|
143
|
+
$out = "${{ runner.temp }}\winget"
|
|
144
|
+
wingetcreate update ${WINGET_PACKAGE_IDENTIFIER} --version $version --urls $url --output $out
|
|
145
|
+
Get-ChildItem $out -Filter '${WINGET_PACKAGE_IDENTIFIER}.*' | ForEach-Object { wingetcreate validate $_.FullName }
|
|
146
|
+
- name: Submit WinGet PR to microsoft/winget-pkgs
|
|
147
|
+
if: ${{ inputs.submit == 'true' }}
|
|
148
|
+
shell: pwsh
|
|
149
|
+
env:
|
|
150
|
+
WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.WINGET_CREATE_GITHUB_TOKEN }}
|
|
151
|
+
run: |
|
|
152
|
+
$catalog = Get-Content -Raw release/catalog.json | ConvertFrom-Json
|
|
153
|
+
$installer = $catalog.artifacts | Where-Object { $_.name -like '*-Setup.exe' } | Select-Object -First 1
|
|
154
|
+
if (-not $installer) { throw 'release/catalog.json missing a *-Setup.exe installer artifact' }
|
|
155
|
+
$version = [string]$catalog.version
|
|
156
|
+
if ($version -notmatch '^\d+\.\d+\.\d+') { throw "unresolved catalog version: $version" }
|
|
157
|
+
$url = "https://github.com/${{ github.repository }}/releases/download/v$version/$($installer.name)"
|
|
158
|
+
wingetcreate update ${WINGET_PACKAGE_IDENTIFIER} --version $version --urls $url --submit --token $env:WINGET_CREATE_GITHUB_TOKEN
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Managed by right-git — do not hand-edit. Run `right-git sync` to update.
|
|
2
|
+
# Template: qualification.yml | Template version: ${TEMPLATE_VERSION}
|
|
3
|
+
name: qualification
|
|
4
|
+
on:
|
|
5
|
+
pull_request:
|
|
6
|
+
push:
|
|
7
|
+
branches: [${DEFAULT_BRANCH}]
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
# F5 fix: see ci.yml for why the guard is its own always-runs job rather
|
|
11
|
+
# than a job-level `if: !private` (which only skipped instead of failing).
|
|
12
|
+
jobs:
|
|
13
|
+
private-repo-guard:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Refuse private repository
|
|
17
|
+
if: ${{ github.event.repository.private }}
|
|
18
|
+
run: |
|
|
19
|
+
echo "::error::right-git: repository is private; managed public-only workflows must not run here."
|
|
20
|
+
exit 1
|
|
21
|
+
qualification:
|
|
22
|
+
needs: [private-repo-guard]
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v5
|
|
26
|
+
- uses: actions/setup-node@v5
|
|
27
|
+
with:
|
|
28
|
+
node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
|
|
29
|
+
package-manager-cache: false
|
|
30
|
+
${PACKAGE_MANAGER_SETUP}
|
|
31
|
+
- run: ${INSTALL_COMMAND}
|
|
32
|
+
${OWNERSHIP_STEP}${SWIFT_PRIVATE_CONFIGURE_STEP}
|
|
33
|
+
- run: ${PM_RUN} test:all${SWIFT_PRIVATE_CLEANUP_STEP}
|
|
34
|
+
schema:
|
|
35
|
+
needs: [qualification]
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v5
|
|
39
|
+
- uses: actions/setup-node@v5
|
|
40
|
+
with:
|
|
41
|
+
node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
|
|
42
|
+
package-manager-cache: false
|
|
43
|
+
${PACKAGE_MANAGER_SETUP}
|
|
44
|
+
- run: ${INSTALL_COMMAND}
|
|
45
|
+
- name: Check schema with evidence log
|
|
46
|
+
shell: bash
|
|
47
|
+
run: |
|
|
48
|
+
set -o pipefail
|
|
49
|
+
node scripts/ci/check-schema.mjs 2>&1 | tee qualification-schema.log
|
|
50
|
+
- name: Upload schema evidence
|
|
51
|
+
if: ${{ always() }}
|
|
52
|
+
uses: actions/upload-artifact@v4
|
|
53
|
+
with:
|
|
54
|
+
name: qualification-schema-${{ github.run_id }}-${{ github.run_attempt }}
|
|
55
|
+
path: qualification-schema.log
|
|
56
|
+
if-no-files-found: error
|
|
57
|
+
security:
|
|
58
|
+
needs: [qualification]
|
|
59
|
+
runs-on: ubuntu-latest
|
|
60
|
+
steps:
|
|
61
|
+
- uses: actions/checkout@v5
|
|
62
|
+
- uses: actions/setup-node@v5
|
|
63
|
+
with:
|
|
64
|
+
node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
|
|
65
|
+
package-manager-cache: false
|
|
66
|
+
${PACKAGE_MANAGER_SETUP}
|
|
67
|
+
- run: ${INSTALL_COMMAND}
|
|
68
|
+
- run: node scripts/ci/check-network-boundary.mjs
|
|
69
|
+
- name: Hostile-repository and secret-egress suite
|
|
70
|
+
run: ${PM_RUN} test:security
|
|
71
|
+
hardening:
|
|
72
|
+
needs: [qualification]
|
|
73
|
+
runs-on: ubuntu-latest
|
|
74
|
+
steps:
|
|
75
|
+
- uses: actions/checkout@v5
|
|
76
|
+
- uses: actions/setup-node@v5
|
|
77
|
+
with:
|
|
78
|
+
node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
|
|
79
|
+
package-manager-cache: false
|
|
80
|
+
${PACKAGE_MANAGER_SETUP}
|
|
81
|
+
- run: ${INSTALL_COMMAND}
|
|
82
|
+
- run: ${PM_RUN} test:hardening
|
|
83
|
+
conformance:
|
|
84
|
+
needs: [qualification]
|
|
85
|
+
runs-on: ubuntu-latest
|
|
86
|
+
steps:
|
|
87
|
+
- uses: actions/checkout@v5
|
|
88
|
+
- uses: actions/setup-node@v5
|
|
89
|
+
with:
|
|
90
|
+
node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
|
|
91
|
+
package-manager-cache: false
|
|
92
|
+
${PACKAGE_MANAGER_SETUP}
|
|
93
|
+
- run: ${INSTALL_COMMAND}
|
|
94
|
+
- run: ${PM_RUN} test:conformance
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Managed by right-git — do not hand-edit. Run `right-git sync` to update.
|
|
2
|
+
# Template: regenerate.yml | Template version: ${TEMPLATE_VERSION}
|
|
3
|
+
# Manual only. Runs the repository's regenerate script (derived artifacts,
|
|
4
|
+
# formatting, lockfile repair) and, when tracked files change, runs the test
|
|
5
|
+
# script on the result, pushes it to a right-git/regenerate-<run> branch and
|
|
6
|
+
# opens a pull request. It never writes to the default branch. Pull requests
|
|
7
|
+
# opened with the workflow token do not trigger pull_request workflows, which
|
|
8
|
+
# is why the checks run here and the PR body links this run.
|
|
9
|
+
name: ${ARTIFACT_PREFIX}-regenerate
|
|
10
|
+
on:
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${ARTIFACT_PREFIX}-regenerate
|
|
16
|
+
cancel-in-progress: false
|
|
17
|
+
jobs:
|
|
18
|
+
private-repo-guard:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- name: Refuse private repository
|
|
22
|
+
if: ${{ github.event.repository.private }}
|
|
23
|
+
run: |
|
|
24
|
+
echo "::error::right-git: repository is private; managed public-only workflows must not run here."
|
|
25
|
+
exit 1
|
|
26
|
+
regenerate:
|
|
27
|
+
needs: [private-repo-guard]
|
|
28
|
+
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
timeout-minutes: 60
|
|
31
|
+
permissions:
|
|
32
|
+
contents: write
|
|
33
|
+
pull-requests: write
|
|
34
|
+
steps:
|
|
35
|
+
- uses: actions/checkout@v5
|
|
36
|
+
with:
|
|
37
|
+
ref: ${{ github.event.repository.default_branch }}
|
|
38
|
+
fetch-depth: 0
|
|
39
|
+
- uses: actions/setup-node@v5
|
|
40
|
+
with:
|
|
41
|
+
node-version: ${NODE_PUBLISH_VERSION}
|
|
42
|
+
package-manager-cache: false
|
|
43
|
+
${PACKAGE_MANAGER_SETUP}
|
|
44
|
+
- run: ${INSTALL_COMMAND}
|
|
45
|
+
${OWNERSHIP_STEP}${SWIFT_PRIVATE_CONFIGURE_STEP}
|
|
46
|
+
- name: Regenerate derived artifacts
|
|
47
|
+
run: ${PM_RUN} ${REGENERATE_SCRIPT}
|
|
48
|
+
- name: Detect regenerated files
|
|
49
|
+
id: changes
|
|
50
|
+
shell: bash
|
|
51
|
+
run: |
|
|
52
|
+
set -euo pipefail
|
|
53
|
+
if [[ -z "$(git status --porcelain)" ]]; then
|
|
54
|
+
echo "Derived artifacts are already current."
|
|
55
|
+
printf 'changed=false\n' >> "$GITHUB_OUTPUT"
|
|
56
|
+
else
|
|
57
|
+
printf 'changed=true\n' >> "$GITHUB_OUTPUT"
|
|
58
|
+
fi
|
|
59
|
+
- name: Test the regenerated tree
|
|
60
|
+
if: steps.changes.outputs.changed == 'true'
|
|
61
|
+
run: ${PM_RUN} test${SWIFT_PRIVATE_CLEANUP_STEP}
|
|
62
|
+
- name: Open a pull request with the regenerated files
|
|
63
|
+
if: steps.changes.outputs.changed == 'true'
|
|
64
|
+
shell: bash
|
|
65
|
+
env:
|
|
66
|
+
GH_TOKEN: ${{ github.token }}
|
|
67
|
+
RIGHT_GIT_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
|
68
|
+
RIGHT_GIT_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
69
|
+
run: |
|
|
70
|
+
set -euo pipefail
|
|
71
|
+
branch="right-git/regenerate-${{ github.run_id }}-${{ github.run_attempt }}"
|
|
72
|
+
git config user.name "github-actions[bot]"
|
|
73
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
74
|
+
git checkout -b "$branch"
|
|
75
|
+
git add -A
|
|
76
|
+
git commit -m "Regenerate derived artifacts"
|
|
77
|
+
git push origin "HEAD:refs/heads/$branch"
|
|
78
|
+
gh pr create --base "$RIGHT_GIT_DEFAULT_BRANCH" --head "$branch" \
|
|
79
|
+
--title "Regenerate derived artifacts" \
|
|
80
|
+
--body "Opened by the right-git regenerate lane. The test script passed on this tree in $RIGHT_GIT_RUN_URL (pull requests opened with the workflow token do not trigger pull_request workflows)."
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Managed by right-git — do not hand-edit. Run `right-git sync` to update.
|
|
2
|
+
# Template: release-candidate.yml | Template version: ${TEMPLATE_VERSION}
|
|
3
|
+
# Adapted from Cortex's release-candidate.yml (DESIGN.md §6). No signing
|
|
4
|
+
# credentials of any kind (invariant I2) — unsigned candidate build only.
|
|
5
|
+
name: release-candidate
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
source_revision:
|
|
10
|
+
description: Exact 40-character lowercase commit SHA to build as the candidate
|
|
11
|
+
required: true
|
|
12
|
+
type: string
|
|
13
|
+
push:
|
|
14
|
+
tags: ['v*']
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
# F5 fix: see ci.yml for why the guard is its own always-runs job rather
|
|
18
|
+
# than a job-level `if: !private` (which only skipped instead of failing).
|
|
19
|
+
jobs:
|
|
20
|
+
private-repo-guard:
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
steps:
|
|
23
|
+
- name: Refuse private repository
|
|
24
|
+
if: ${{ github.event.repository.private }}
|
|
25
|
+
run: |
|
|
26
|
+
echo "::error::right-git: repository is private; managed public-only workflows must not run here."
|
|
27
|
+
exit 1
|
|
28
|
+
candidate:
|
|
29
|
+
needs: [private-repo-guard]
|
|
30
|
+
strategy:
|
|
31
|
+
fail-fast: false
|
|
32
|
+
matrix:
|
|
33
|
+
os: ${OS_MATRIX}
|
|
34
|
+
runs-on: ${{ matrix.os }}
|
|
35
|
+
steps:
|
|
36
|
+
# A dispatch builds the commit it names; a tag push has no input and builds the pushed commit.
|
|
37
|
+
- uses: actions/checkout@v5
|
|
38
|
+
with:
|
|
39
|
+
ref: ${{ inputs.source_revision || github.sha }}
|
|
40
|
+
- uses: actions/setup-node@v5
|
|
41
|
+
with:
|
|
42
|
+
node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
|
|
43
|
+
package-manager-cache: false
|
|
44
|
+
${PACKAGE_MANAGER_SETUP}
|
|
45
|
+
- run: ${INSTALL_COMMAND}
|
|
46
|
+
${OWNERSHIP_STEP}${SWIFT_PRIVATE_CONFIGURE_STEP}
|
|
47
|
+
- run: node --test tests/release-candidate.test.mjs
|
|
48
|
+
- run: node scripts/release/build-candidate.mjs --platform current --out "${{ runner.temp }}/${ARTIFACT_PREFIX}-rc"
|
|
49
|
+
- run: node scripts/release/check-release.mjs "${{ runner.temp }}/${ARTIFACT_PREFIX}-rc"${SWIFT_PRIVATE_CLEANUP_STEP}
|
|
50
|
+
- uses: actions/upload-artifact@v4
|
|
51
|
+
with:
|
|
52
|
+
name: ${ARTIFACT_PREFIX}-rc-${{ matrix.os }}
|
|
53
|
+
path: |
|
|
54
|
+
${{ runner.temp }}/${ARTIFACT_PREFIX}-rc/**
|
|
55
|
+
${{ runner.temp }}/${ARTIFACT_PREFIX}-*.tar.gz
|
|
56
|
+
${{ runner.temp }}/${ARTIFACT_PREFIX}-*.zip
|
|
57
|
+
${{ runner.temp }}/${ARTIFACT_PREFIX}-*.sha256
|