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
4 changes: 3 additions & 1 deletion .github/workflows/release-dry-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Validate prospective release tag
run: npm run release:tag -- "v$(node -p \"require('./package.json').version\")"
run: |
prospective_tag="v$(node -p "require('./package.json').version")"
npm run release:tag -- "$prospective_tag"
- name: Install ReleaseBox
run: |
set -euo pipefail
Expand Down
14 changes: 13 additions & 1 deletion tests/release.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,17 @@ test("release workflow validates before publishing and publishes before GitHub r

test("dry run validates a prospective package tag", () => {
const workflow = readFileSync(".github/workflows/release-dry-run.yml", "utf8");
assert.match(workflow, /npm run release:tag -- "v\$\(node/);
const step = workflow.match(/- name: Validate prospective release tag\n {8}run: \|\n((?: {10}.*\n)+)/);
assert.ok(step, "prospective release tag step must use a shell block");

const command = step[1]
.split("\n")
.filter(Boolean)
.map((line) => line.slice(10))
.join("\n");
const run = spawnSync("bash", ["-euo", "pipefail", "-c", command], { encoding: "utf8" });

assert.equal(run.status, 0, run.stderr);
assert.match(run.stdout, /Release tag v0\.1\.0 matches package version 0\.1\.0\./);
assert.ok(workflow.indexOf("Validate prospective release tag") < workflow.indexOf("Run release checks"));
});