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: 1 addition & 1 deletion .github/scripts/quickstart-smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if ((mode !== "--published" && mode !== "--local") || !target) {

const windows = process.platform === "win32";
const command =
mode === "--published" ? ["npx", "--yes", `offing@${target}`] : ["node", target];
mode === "--published" ? ["npx", "--yes", `@velella/offing@${target}`] : ["node", target];

function run(args) {
const [program, ...rest] = command;
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gitlab-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ jobs:
run: |
version="${GITHUB_REF_NAME#v}"
for _ in $(seq 1 "$POLL_ATTEMPTS"); do
if [ "$(npm view "offing@${version}" version 2>/dev/null)" = "$version" ]; then exit 0; fi
if [ "$(npm view "@velella/offing@${version}" version 2>/dev/null)" = "$version" ]; then exit 0; fi
sleep "$POLL_INTERVAL_SECONDS"
done
minutes=$((POLL_ATTEMPTS * POLL_INTERVAL_SECONDS / 60))
echo "offing@${version} is not on npm after ${minutes} minutes; the component's pinned package would not install." >&2
echo "@velella/offing@${version} is not on npm after ${minutes} minutes; the component's pinned package would not install." >&2
exit 1
- name: Push to GitLab
env:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ jobs:
# npm says a new version "may take a few minutes to become available"; 0.2.0 took longer than the
# first ten-attempt wait of 2.5 minutes, so wait up to ten minutes.
for attempt in $(seq 1 40); do
if npm view "offing@$version" version >/dev/null 2>&1; then exit 0; fi
if npm view "@velella/offing@$version" version >/dev/null 2>&1; then exit 0; fi
echo "Attempt $attempt: $version is not visible yet."
sleep 15
done
echo "offing@$version never appeared on the registry." >&2
echo "@velella/offing@$version never appeared on the registry." >&2
exit 1
- name: Run the published package on a small fixture
# Run from a temporary directory: inside the checkout, npx would resolve this repository's own bin.
Expand All @@ -56,7 +56,7 @@ jobs:
version="${GITHUB_REF_NAME#v}"
mkdir -p "$RUNNER_TEMP/offing-smoke"
cp "$GITHUB_WORKSPACE/tests/fixtures/smoke/package.json.fixture" "$RUNNER_TEMP/offing-smoke/package.json"
node "$GITHUB_WORKSPACE/.github/scripts/smoke.mjs" "$RUNNER_TEMP/offing-smoke" -- npx --yes "offing@$version"
node "$GITHUB_WORKSPACE/.github/scripts/smoke.mjs" "$RUNNER_TEMP/offing-smoke" -- npx --yes "@velella/offing@$version"
# The release fails if the npm attestation is missing or does not match the published tarball.
# npm generates it during trusted publishing on a GitHub-hosted runner, so the builder identity
Expand All @@ -78,10 +78,10 @@ jobs:
TAG: ${{ github.ref_name }}
run: |
version="${TAG#v}"
curl -fsSL --retry 3 -o package.tgz "$(npm view "offing@$version" dist.tarball)"
url="$(npm view "offing@$version" --json | jq -r '.dist.attestations.url')"
curl -fsSL --retry 3 -o package.tgz "$(npm view "@velella/offing@$version" dist.tarball)"
url="$(npm view "@velella/offing@$version" --json | jq -r '.dist.attestations.url')"
if [ -z "$url" ] || [ "$url" = "null" ]; then
echo "offing@$version has no npm provenance attestation." >&2
echo "@velella/offing@$version has no npm provenance attestation." >&2
exit 1
fi
curl -fsSL --retry 3 -o attestations.json "$url"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
working-directory: ${{ runner.temp }}
env:
VERSION: ${{ steps.release.outputs.version }}
run: npx --yes "offing@$VERSION" scan "$GITHUB_WORKSPACE" --json > "$RUNNER_TEMP/published.json"
run: npx --yes "@velella/offing@$VERSION" scan "$GITHUB_WORKSPACE" --json > "$RUNNER_TEMP/published.json"
- name: Compare the summaries
run: node .github/scripts/release-smoke.mjs "$RUNNER_TEMP/built.json" "$RUNNER_TEMP/published.json"

Expand Down Expand Up @@ -115,6 +115,6 @@ jobs:
node "$GITHUB_WORKSPACE/.github/scripts/smoke.mjs" "$dir" -- node "$cli"
node "$GITHUB_WORKSPACE/.github/scripts/quickstart-smoke.mjs" --local "$cli"
else
node "$GITHUB_WORKSPACE/.github/scripts/smoke.mjs" "$dir" -- npx --yes "offing@$VERSION"
node "$GITHUB_WORKSPACE/.github/scripts/smoke.mjs" "$dir" -- npx --yes "@velella/offing@$VERSION"
node "$GITHUB_WORKSPACE/.github/scripts/quickstart-smoke.mjs" --published "$VERSION"
fi
2 changes: 1 addition & 1 deletion tests/release-smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ test("the release workflow compares the published package with the build after a
const job = smoke.jobs["published-scan"]!;
assert.match(job.if!, /!inputs\.dry_run/);
const commands = job.steps.map((step) => step.run ?? "").join("\n");
assert.match(commands, /npx --yes "offing@\$VERSION" scan/);
assert.match(commands, /npx --yes "@velella\/offing@\$VERSION" scan/);
assert.match(commands, /dist\/src\/cli\.js scan/);
assert.match(commands, /release-smoke\.mjs/);
assert.equal(job.permissions, undefined, "inherits the read-only workflow permissions");
Expand Down
2 changes: 1 addition & 1 deletion tests/smoke.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test("the publish workflow runs the smoke script on a fresh job after publishing
assert.deepEqual(smokeJob.permissions, { contents: "read" });
const step = smokeJob.steps.find((item) => item.run?.includes("smoke.mjs"));
assert.ok(step, "a step runs smoke.mjs");
assert.match(step.run!, /npx --yes "offing@\$version"/);
assert.match(step.run!, /npx --yes "@velella\/offing@\$version"/);
assert.match(
step["working-directory"] ?? "",
/runner\.temp/,
Expand Down
Loading