1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Configuration for `cargo release`
# (https://github.com/crate-ci/cargo-release/blob/master/docs/reference.md)
= ["main"]
# `cargo release` only *warns* when the local branch is behind its upstream and
# then proceeds: it publishes to crates.io (irreversible) and only afterwards
# fails to push the release commit and tag (this happened with v0.3.4). A
# pre-release hook aborts the release before publishing, so fail hard here if
# the branch is stale.
= [
"sh",
"-c",
"git fetch origin && test \"$(git rev-list --count 'HEAD..@{upstream}')\" -eq 0 || { echo 'error: branch is behind its upstream; run git pull first' >&2; exit 1; }",
]
# cargo `dist` builds the GitHub release body from the CHANGELOG.md section whose
# heading names the version being released. There is no fallback to an
# "Unreleased" heading: a release whose version is missing from the changelog is
# published with no release notes at all. Rewriting the heading here puts it in
# the release commit that gets tagged, which is the commit `dist` reads in CI.
# The first replacement closes the section written during the cycle, the second
# reopens an empty one for the next; `exactly = 1` aborts the release before
# publishing to crates.io if the changelog ever stops matching these patterns.
[[]]
= "CHANGELOG.md"
= "## \\[Unreleased\\] - ReleaseDate"
= "## [{{version}}] - {{date}}"
= 1
[[]]
= "CHANGELOG.md"
= "<!-- next-header -->"
= "<!-- next-header -->\n\n## [Unreleased] - ReleaseDate"
= 1
# The version is spelled out in the docs as well: the `rev:` of the pre-commit
# snippets, and the `blockwatch` version and `helpUri` of the SARIF sample
# output. The `crate-version` block in Cargo.toml lists them all and fails
# a run once any of them goes stale, so they are rewritten here to keep that
# check green. `exactly` aborts the release before publishing to crates.io if a
# snippet is ever reworded past these patterns.
[[]]
= "README.md"
= "rev: v[0-9]+\\.[0-9]+\\.[0-9]+"
= "rev: v{{version}}"
= 1
[[]]
= "docs/ci.md"
= "rev: v[0-9]+\\.[0-9]+\\.[0-9]+"
= "rev: v{{version}}"
= 2
# Both keys carry the same number and sit on consecutive lines. They are matched
# together because the driver's `"version"` is otherwise indistinguishable from
# the SARIF format's own `"version": "2.1.0"` earlier in the same sample.
[[]]
= "docs/cli.md"
= "\"version\": \"[0-9]+\\.[0-9]+\\.[0-9]+\",\\s+\"semanticVersion\": \"[0-9]+\\.[0-9]+\\.[0-9]+\""
= "\"version\": \"{{version}}\",\n \"semanticVersion\": \"{{version}}\""
= 1
[[]]
= "docs/cli.md"
= "blockwatch/blob/v[0-9]+\\.[0-9]+\\.[0-9]+/"
= "blockwatch/blob/v{{version}}/"
= 1