Change release process to use towncrier and delay regenerating README
1. Use [towncrier][1] to generate release notes/CHANGELOG instead of auto-generating it from git commit messages. 2. Move release scripts into a Justfile. 3. Only regenerate the top-level README file when making a release, don't force it to be up to date in between releases. Point 3 helps prevent documentation for unreleased changes from being shown to users on GitHub, which may otherwise be confusing. [1]: https://towncrier.readthedocs.io/en/stable/index.html#
This commit is contained in:
13
.github/renovate.json5
vendored
13
.github/renovate.json5
vendored
@@ -22,6 +22,19 @@
|
|||||||
"packageNameTemplate": "rust-lang/rust",
|
"packageNameTemplate": "rust-lang/rust",
|
||||||
"datasourceTemplate": "github-releases"
|
"datasourceTemplate": "github-releases"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"customType": "regex",
|
||||||
|
"fileMatch": ["^Justfile$"],
|
||||||
|
"matchStrings": [
|
||||||
|
// https://regex101.com/r/vOmY6R/1
|
||||||
|
// Matching on word boundaries (\b) around start and end ensures we
|
||||||
|
// match variations like "towncrier==1.2.3" as well as "pipx run
|
||||||
|
// towncrier==1.2.3", adding some future proofness.
|
||||||
|
"\".*\\btowncrier==(?<currentValue>.+?)\\b\""
|
||||||
|
],
|
||||||
|
"depNameTemplate": "towncrier",
|
||||||
|
"datasourceTemplate": "pypi"
|
||||||
|
},
|
||||||
],
|
],
|
||||||
packageRules: [
|
packageRules: [
|
||||||
{
|
{
|
||||||
|
|||||||
2
.github/workflows/publish-crate.yml
vendored
2
.github/workflows/publish-crate.yml
vendored
@@ -15,5 +15,5 @@ jobs:
|
|||||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
|
||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: ./.github/actions/setup-ci
|
||||||
- run: cargo publish
|
- run: cargo publish
|
||||||
|
|||||||
@@ -30,8 +30,3 @@ repos:
|
|||||||
language: system
|
language: system
|
||||||
files: \.rs$
|
files: \.rs$
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
- id: README
|
|
||||||
name: Render README.md
|
|
||||||
entry: docs/generate.sh
|
|
||||||
language: script
|
|
||||||
files: ^(README\.md)|(docs/.*)
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
<!-- towncrier release notes start -->
|
||||||
|
|
||||||
## v23.12.0 (2023-12-03)
|
## v23.12.0 (2023-12-03)
|
||||||
|
|
||||||
### New
|
### New
|
||||||
|
|||||||
@@ -74,4 +74,9 @@ If you don't feel comfortable writing user documentation, I will be happy to gui
|
|||||||
|
|
||||||
> **⚠ Warning**
|
> **⚠ Warning**
|
||||||
>
|
>
|
||||||
> If you update the README file, take note that you must edit the fragments in the [docs](docs/) directory as opposed to the README in the root of the repository, which is auto-generated.
|
> If you update the README file, take note that you must edit the fragments in the [docs](docs/) directory as opposed to the README in the root of the repository, which is auto-generated with every release.
|
||||||
|
|
||||||
|
## Release notes
|
||||||
|
|
||||||
|
[Towncrier](https://towncrier.readthedocs.io/en/stable/index.html) is used to generate release notes.
|
||||||
|
If you add a changelog fragment to the `changelog.d` directory with `just add-changelog` (requires [just](https://github.com/casey/just#installation)) it will automatically be picked up when a new release is made.
|
||||||
|
|||||||
67
Justfile
Normal file
67
Justfile
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
towncrier_cmd := "pipx run towncrier==24.7.0"
|
||||||
|
|
||||||
|
_default:
|
||||||
|
@{{just_executable()}} --choose
|
||||||
|
|
||||||
|
# Add a new changelog entry using towncrier
|
||||||
|
add-changelog:
|
||||||
|
{{towncrier_cmd}} create --edit
|
||||||
|
git add changelog.d
|
||||||
|
|
||||||
|
# Create a new release
|
||||||
|
make-new-release:
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
get_next_version_number() {
|
||||||
|
DATEPART=$(date +%y.%-m)
|
||||||
|
ITERATION=0
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
VERSION_STRING="${DATEPART}.${ITERATION}"
|
||||||
|
if git rev-list "v$VERSION_STRING" > /dev/null 2>&1; then
|
||||||
|
((ITERATION++))
|
||||||
|
else
|
||||||
|
echo "$VERSION_STRING"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
git add .
|
||||||
|
if ! git diff-index --quiet HEAD; then
|
||||||
|
printf "Working directory is not clean. Please commit or stash your changes.\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION=$(get_next_version_number)
|
||||||
|
COMMITMSG=$(mktemp --tmpdir commitmsg.XXXXXXXXXX)
|
||||||
|
trap 'rm "$COMMITMSG"' EXIT
|
||||||
|
set -x
|
||||||
|
|
||||||
|
cargo set-version "${VERSION}"
|
||||||
|
|
||||||
|
# Construct a git commit message.
|
||||||
|
# This must be done before the next step so we can leverage the --draft
|
||||||
|
# flag here to get a list of changes being introduced by this release.
|
||||||
|
printf "Release v${VERSION}\n\n" > "$COMMITMSG"
|
||||||
|
{{towncrier_cmd}} build --draft --version "${VERSION}" >> "$COMMITMSG"
|
||||||
|
|
||||||
|
# Generate changelog and docs
|
||||||
|
{{towncrier_cmd}} build --version "${VERSION}"
|
||||||
|
docs/generate.sh
|
||||||
|
|
||||||
|
# Stage all the changes we've prepared
|
||||||
|
git add .
|
||||||
|
# There are likely trailing whitespace changes in the changelog, but a single
|
||||||
|
# run of pre-commit will fix these automatically.
|
||||||
|
pre-commit run || git add .
|
||||||
|
|
||||||
|
git commit --file "$COMMITMSG"
|
||||||
|
git tag "v${VERSION}"
|
||||||
|
|
||||||
|
set +x
|
||||||
|
printf "\n\nSuccessfully created release %s\n" "v${VERSION}"
|
||||||
|
printf "\nYou'll probably want to continue with:\n"
|
||||||
|
printf "\tgit push origin main\n"
|
||||||
|
printf "\tgit push origin %s\n" "v${VERSION}"
|
||||||
4
changelog.d/+52650337.change.md
Normal file
4
changelog.d/+52650337.change.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
Bump to the minimum supported Rust version to 1.80.0
|
||||||
|
|
||||||
|
Obsidian-export now uses [std::sync::LazyLock](https://doc.rust-lang.org/std/sync/struct.LazyLock.html) instead of [lazy_static](https://crates.io/crates/lazy_static), which was only stabilized in Rust 1.80.0.
|
||||||
|
This change made it possible to drop the external dependency on lazy_static, though as a result of this, compiling with older versions will no longer be possible.
|
||||||
0
changelog.d/.gitignore
vendored
Normal file
0
changelog.d/.gitignore
vendored
Normal file
1
changelog.d/154.new.md
Symbolic link
1
changelog.d/154.new.md
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
204.new.md
|
||||||
5
changelog.d/204.new.md
Normal file
5
changelog.d/204.new.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Optionally preserve modified time of exported files
|
||||||
|
|
||||||
|
Add a new argument `--preserve-mtime` to keep the original modified time attribute of notes being exported, instead of setting them to the current time.
|
||||||
|
|
||||||
|
Contribution made by [Davis Davalos-DeLosh](https://github.com/Programmerino).
|
||||||
50
changelog.d/template.md
Normal file
50
changelog.d/template.md
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{% if render_title %}
|
||||||
|
## v{{ versiondata.version }} ({{ versiondata.date }})
|
||||||
|
{% endif %}
|
||||||
|
{% for section, _ in sections.items() %}
|
||||||
|
{% if section %}
|
||||||
|
|
||||||
|
## {{section}}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if sections[section] %}
|
||||||
|
{% for category, val in definitions.items() if category in sections[section] %}
|
||||||
|
### {{ definitions[category]['name'] }}
|
||||||
|
|
||||||
|
{% for text, values in sections[section][category].items() %}
|
||||||
|
- {{ text }}
|
||||||
|
{%- if values %}
|
||||||
|
{% if "\n - " in text or '\n * ' in text %}
|
||||||
|
|
||||||
|
|
||||||
|
(
|
||||||
|
{%- else %}
|
||||||
|
{% if text %} ({% endif %}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- for issue in values %}
|
||||||
|
{{ issue.split(": ", 1)[0] }}{% if not loop.last %}, {% endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{% if text %}){% endif %}
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if issues_by_category[section][category] and "]: " in issues_by_category[section][category][0] %}
|
||||||
|
{% for issue in issues_by_category[section][category] %}
|
||||||
|
{{ issue }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% if sections[section][category]|length == 0 %}
|
||||||
|
No significant changes.
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
No significant changes.
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% endfor +%}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# Release process
|
# Release process
|
||||||
|
|
||||||
- [ ] Run `./make-new-release.sh`
|
- [ ] Run `just make-new-release`
|
||||||
- [ ] Push the created release commit/tag to GitHub
|
- [ ] Push the created release commit/tag to GitHub
|
||||||
- [ ] Wait for builds to turn green (<https://github.com/zoni/obsidian-export/actions>) and confirm everything looks OK.
|
- [ ] Wait for builds to turn green (<https://github.com/zoni/obsidian-export/actions>) and confirm everything looks OK.
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
get_next_version_number() {
|
|
||||||
DATEPART=$(date +%y.%-m)
|
|
||||||
ITERATION=0
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
VERSION_STRING="${DATEPART}.${ITERATION}"
|
|
||||||
if git rev-list "v$VERSION_STRING" > /dev/null 2>&1; then
|
|
||||||
((ITERATION++))
|
|
||||||
else
|
|
||||||
echo "$VERSION_STRING"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
git add .
|
|
||||||
if ! git diff-index --quiet HEAD; then
|
|
||||||
printf "Working directory is not clean. Please commit or stash your changes.\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
VERSION=$(get_next_version_number)
|
|
||||||
git tag "v${VERSION}"
|
|
||||||
|
|
||||||
git cliff --latest --prepend CHANGELOG.md > /dev/null
|
|
||||||
${EDITOR:-vim} CHANGELOG.md
|
|
||||||
docs/generate.sh
|
|
||||||
|
|
||||||
sed -i -E "s/^version = \".+\"$/version = \"${VERSION}\"/" Cargo.toml
|
|
||||||
cargo check
|
|
||||||
|
|
||||||
git add .
|
|
||||||
# There are likely trailing whitespace changes in the changelog, but a single
|
|
||||||
# run of pre-commit will fix these automatically.
|
|
||||||
pre-commit run || git add .
|
|
||||||
|
|
||||||
git commit --message "Release v${VERSION}"
|
|
||||||
git tag "v${VERSION}" --force
|
|
||||||
|
|
||||||
printf "\n\nSuccessfully created release %s\n" "v${VERSION}"
|
|
||||||
printf "\nYou'll probably want to continue with:\n"
|
|
||||||
printf "\tgit push origin main\n"
|
|
||||||
printf "\tgit push origin %s\n" "v${VERSION}"
|
|
||||||
34
towncrier.toml
Normal file
34
towncrier.toml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[tool.towncrier]
|
||||||
|
name = "obsidian-export"
|
||||||
|
directory = "changelog.d"
|
||||||
|
template = "changelog.d/template.md"
|
||||||
|
filename = "CHANGELOG.md"
|
||||||
|
start_string = "<!-- towncrier release notes start -->\n"
|
||||||
|
underlines = ["", "", ""]
|
||||||
|
title_format = ""
|
||||||
|
issue_format = "[#{issue}](https://github.com/zoni/obsidian-export/issues/{issue})"
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "new"
|
||||||
|
name = "New Features"
|
||||||
|
showcontent = true
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "change"
|
||||||
|
name = "Changes"
|
||||||
|
showcontent = true
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "fix"
|
||||||
|
name = "Fixes"
|
||||||
|
showcontent = true
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "breaking"
|
||||||
|
name = "Backwards-incompatible Changes"
|
||||||
|
showcontent = true
|
||||||
|
|
||||||
|
[[tool.towncrier.type]]
|
||||||
|
directory = "deprecation"
|
||||||
|
name = "Deprecations"
|
||||||
|
showcontent = true
|
||||||
Reference in New Issue
Block a user