Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
Expand Down
4 changes: 4 additions & 0 deletions tests/package-contract.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ test('npm publishing uses trusted publishing instead of repository tokens', () =
assert.match(publishWorkflow, /id-token:\s+write/);
assert.match(publishWorkflow, /npm publish --access public --provenance/);
assert.doesNotMatch(publishWorkflow, /NODE_AUTH_TOKEN|NPM_TOKEN/);
assert.match(
publishWorkflow,
/actions\/checkout@v4\s+with:\s+fetch-depth:\s+0/,
);
assert.match(publishWorkflow, /playwright install --with-deps chromium/);
assert.match(publishWorkflow, /npm run release:preflight/);
});
Expand Down
28 changes: 21 additions & 7 deletions tests/release-provenance.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,28 @@ test('published JSON schema describes the executable provenance contract', async
assert.match(DIGEST, new RegExp(schema.properties.interaction_contract_digest.pattern));
});

test('the 0.3.3 candidate remains untagged until the protected release', async () => {
const result = await checkReleaseProvenance({
repoRoot: resolve(import.meta.dirname, '..'),
allowUnreleased: true,
test('candidate tag state is reported from an isolated repository', async () => {
await withRepository(async (root) => {
await generateReleaseProvenance({
repoRoot: root,
interactionContractDigest: DIGEST,
});
git(root, 'add', 'RELEASE_PROVENANCE.json');
git(root, 'commit', '--quiet', '-m', 'attest candidate');

const untagged = await checkReleaseProvenance({
repoRoot: root,
allowUnreleased: true,
});
assert.equal(untagged.tag, 'v0.3.3');
assert.equal(untagged.tagExists, false);
assert.equal(untagged.currentAheadOfPublishedTag, false);

git(root, 'tag', 'v0.3.3');
const tagged = await checkReleaseProvenance({ repoRoot: root });
assert.equal(tagged.tagExists, true);
assert.equal(tagged.currentAheadOfPublishedTag, false);
});
assert.equal(result.tag, 'v0.3.3');
assert.equal(result.tagExists, false);
assert.equal(result.currentAheadOfPublishedTag, false);
});

test('formal provenance generation uses a clean frozen commit and cannot re-sign a tag', async () => {
Expand Down
Loading