Skip to content

Commit ca5269a

Browse files
authored
chore: add git cliff and prepare-relase script (#5639)
1 parent 6efb74f commit ca5269a

File tree

10 files changed

+843
-164
lines changed

10 files changed

+843
-164
lines changed

.github/mergeable.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,5 @@
11
# Changelog
22

3-
## [Unreleased][unreleased]
4-
5-
### Added
6-
- enable drag & drop for the account order
7-
8-
### Fixed
9-
- show appropriate messages when scanning wrong qr codes #5563
10-
- fix: remove the option to select info messages with Ctrl + Up/Down #5337
11-
- fix: open https links case insensitive #5625
12-
- don't start chat for mailto links on chatmail accounts
13-
14-
### Changed
15-
16-
- Removed "Watch Sent Folder" preference. #5611
17-
18-
### Changed
19-
- replace rust/wasm message-parser with javascript lib linkify
20-
- removes experimental markdown support
21-
- fixes some link parsing issues
22-
233
<a id="2_22_0"></a>
244

255
## [2.22.0] - 2025-10-17

CONTRIBUTING.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,34 @@ Otherwise fork the repository and create a branch in your fork.
5858

5959
Please add a meaningful description to your PR
6060
so that reviewers get an idea about what the modifications are supposed to do.
61-
Add a meaningful line to `CHANGELOG.md` that is at least roughly understandable by the end user.
62-
If you added changes that have no impact on the end user or are not visible to the end user
63-
you should add a line in the PR description, starting with `#skip-changelog` followed by a
64-
short explanation of why it's not needed.
61+
62+
### Commit Messages and Changelog
63+
64+
We use [Conventional Commits](https://www.conventionalcommits.org/) to automatically generate our changelog.
65+
Each commit message should follow this format:
66+
67+
```
68+
<type>[optional scope]: <description>
69+
```
70+
71+
Common types:
72+
73+
- `feat:` or `add:` - New features (appears in "Added" section)
74+
- `fix:` - Bug fixes (appears in "Fixed" section)
75+
- `change:` or `update:` - Changes to existing functionality (appears in "Changed" section)
76+
- `remove:` - Removal of features (appears in "Removed" section)
77+
- `docs:`, `test:`, `chore:`, `ci:` - Changes that don't appear in the changelog
78+
79+
Examples:
80+
81+
```
82+
feat: add support for multiple selection in chat list
83+
fix: prevent crash when scanning invalid QR codes
84+
change: update electron from 37.1.0 to 37.6.0
85+
docs: update contributing guidelines
86+
```
87+
88+
see [cliff config](./cliff.toml)
6589

6690
If the changes affect the user interface,
6791
screenshots are very helpful,
@@ -112,7 +136,8 @@ To ensure the correct merge strategy, merging is left to the PR author:
112136

113137
- Usually, PRs are squash-merged
114138
as UI development often results in tiny tweak commits that are not that meaningful on their own.
115-
- If all commits are meaningful and have a well-written description,
139+
**When squash-merging, ensure the final commit message follows the conventional commit format.**
140+
- If all commits are meaningful, follow conventional commit format, and have a well-written description,
116141
they can be rebased-merged.
117142

118143
If you do not have write access to the repository,

RELEASE.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,19 @@
7979
## Releasing
8080

8181
1. Create a new branch for the new version (you could name it
82-
`prepare_versioncode`, for example `prepare_1.3.0`)
83-
2. Update the `CHANGELOG.md` file (put the stuff in "unreleased" under a
84-
section with your new version code)
85-
3. Do not forget to update the tag links at the end of the `CHANGELOG.md` file!
86-
4. add the release to `packages/target-tauri/metainfo.xml`
87-
5. Change `version` field in `package.json` to `X.Y.Z`
88-
6. Run `pnpm -w update:target-versions` to update versions in the other packages
89-
7. Open a PR for your branch and get it reviewed.
90-
8. As soon as your PR is approved merge it to `main`
91-
9. After the PR is merged, checkout the latest version on `main`. Tag the latest commit
82+
`prepare-version-<version>`, for example `prepare-release-2.23.0`)
83+
2. Run `pnpm prepare-release <version>`
84+
3. check and cleanup the changes added to CHANGELOG
85+
4. Open a PR for your branch and get it reviewed.
86+
5. As soon as your PR is approved merge it to `main`
87+
6. After the PR is merged, checkout the latest version on `main`. Tag the latest commit
9288
with your version number:
9389
```bash
94-
git tag <tagname> # for example v1.43.2
90+
git tag v<version> # for example v2.23.0
9591
git push origin main --tags
9692
```
97-
10. The deployment script creates a [release](https://github.com/deltachat/deltachat-desktop/releases)
98-
draft on github which needs to be updated and published manually:
93+
7. The deployment script creates a [release](https://github.com/deltachat/deltachat-desktop/releases)
94+
draft on github which needs to be updated and published manually:
9995

10096
- Copy the relevant part of the `CHANGELOG.md` file into the description field
10197
- for fresh releases this includes the changelog of the test releases

bin/prepare-release.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
# Prepare a new release
3+
#
4+
# Usage: ./bin/prepare-release.sh 2.23.0
5+
6+
set -e
7+
8+
if [ -z "$1" ]; then
9+
echo "❌ Error: Version argument required"
10+
echo "Usage: ./bin/prepare-release.sh VERSION"
11+
exit 1
12+
fi
13+
14+
VERSION="$1"
15+
CLEAN_VERSION=$(echo "$VERSION" | sed 's/^v//')
16+
17+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
19+
20+
cd "$PROJECT_ROOT"
21+
22+
echo "Preparing release ${CLEAN_VERSION}"
23+
echo "=================================="
24+
echo ""
25+
26+
# Step 1: Update version in all package.json files and Cargo.toml
27+
echo "📦 Step 1: Updating version numbers..."
28+
node ./bin/update_desktop_version.js "$CLEAN_VERSION"
29+
echo ""
30+
31+
# Step 2: Update CHANGELOG
32+
echo "📝 Step 2: Updating CHANGELOG..."
33+
./bin/update-changelog.sh "$CLEAN_VERSION"
34+
echo ""
35+
36+
# Step 3: Format package.json files
37+
echo "🎨 Step 3: Formatting package.json files..."
38+
pnpm prettier --write --log-level=silent "packages/target**/package.json" "package.json"
39+
echo "✅ Formatted package.json files"
40+
echo ""
41+
42+
# Step 4: Update pnpm lock file
43+
echo "🔒 Step 4: Updating pnpm-lock.yaml..."
44+
pnpm install --lockfile-only
45+
echo "✅ Updated pnpm-lock.yaml"
46+
echo ""
47+
48+
echo "✅ Release ${CLEAN_VERSION} prepared successfully!"
49+
echo ""
50+
echo "📝 Next steps:"
51+
echo " 1. Review and cleanup the CHANGELOG.md"
52+
echo " 2. Make any manual edits if needed"
53+
echo " 3. Add all changes and commit everything:"
54+
echo " git checkout -b \"prepare-release-${CLEAN_VERSION}\""
55+
echo " git commit -m \"chore: prepare release ${CLEAN_VERSION}\""
56+
echo " 4. When merged create and push the tag:"
57+
echo " git tag v${CLEAN_VERSION}"
58+
echo " git push origin v${CLEAN_VERSION}"
59+
echo ""

bin/update-changelog.sh

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/bin/bash
2+
# Helper script to update changelog and footer links
3+
#
4+
# Usage:
5+
# ./bin/update-changelog.sh 2.23.0 # Prepare release 2.23.0 (before tagging)
6+
7+
set -e
8+
9+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
11+
12+
cd "$PROJECT_ROOT"
13+
14+
# Get the version argument if provided
15+
NEW_VERSION="$1"
16+
17+
echo "🔄 Updating changelog..."
18+
19+
# Get the latest tag
20+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
21+
22+
if [ -n "$NEW_VERSION" ]; then
23+
# Releasing a specific version - generate for unreleased commits
24+
echo "📝 Preparing release ${NEW_VERSION}"
25+
26+
# Generate unreleased changelog
27+
git cliff --unreleased --tag $NEW_VERSION --prepend CHANGELOG.md
28+
29+
# Replace [Unreleased] with the version and today's date
30+
TODAY=$(date +%Y-%m-%d)
31+
CLEAN_VERSION=$(echo "$NEW_VERSION" | sed 's/^v//')
32+
VERSION_ANCHOR=$(echo "$CLEAN_VERSION" | sed 's/\./_/g')
33+
34+
# Replace the Unreleased section header with the version header
35+
sed -i "s/## \[Unreleased\]\[unreleased\]/<a id=\"${VERSION_ANCHOR}\"><\/a>\n\n## [${CLEAN_VERSION}] - ${TODAY}/" CHANGELOG.md
36+
37+
# Remove trailing whitespace
38+
sed -i 's/[[:space:]]*$//' CHANGELOG.md
39+
40+
echo "✅ Added version section for ${CLEAN_VERSION}"
41+
42+
# Update LATEST_TAG to the new version for footer processing
43+
LATEST_TAG="v${CLEAN_VERSION}"
44+
else
45+
# No version specified - just update unreleased
46+
echo "📝 Updating unreleased commits"
47+
git cliff --unreleased --prepend CHANGELOG.md
48+
fi
49+
50+
# Update footer links
51+
if [ -n "$NEW_VERSION" ]; then
52+
# We're preparing a release - update footer for the new version
53+
CLEAN_VERSION=$(echo "$NEW_VERSION" | sed 's/^v//')
54+
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
55+
56+
if [ -n "$PREV_TAG" ]; then
57+
# Replace or add the version link
58+
if grep -q "^\[${CLEAN_VERSION}\]:" CHANGELOG.md; then
59+
sed -i "s|^\[${CLEAN_VERSION}\]:.*|[${CLEAN_VERSION}]: https://github.com/deltachat/deltachat-desktop/compare/${PREV_TAG}...v${CLEAN_VERSION}|" CHANGELOG.md
60+
else
61+
# Add new version link at the top of the footer
62+
if grep -q "^\[unreleased\]:" CHANGELOG.md; then
63+
sed -i "/^\[unreleased\]:/a [${CLEAN_VERSION}]: https://github.com/deltachat/deltachat-desktop/compare/${PREV_TAG}...v${CLEAN_VERSION}" CHANGELOG.md
64+
else
65+
# No links yet, add before the generated comment
66+
if grep -q "<!-- generated by git-cliff -->" CHANGELOG.md; then
67+
sed -i "/<!-- generated by git-cliff -->/i [${CLEAN_VERSION}]: https://github.com/deltachat/deltachat-desktop/compare/${PREV_TAG}...v${CLEAN_VERSION}\n" CHANGELOG.md
68+
fi
69+
fi
70+
fi
71+
72+
# Update unreleased link to point from new version
73+
if grep -q "^\[unreleased\]:" CHANGELOG.md; then
74+
sed -i "s|^\[unreleased\]:.*|[unreleased]: https://github.com/deltachat/deltachat-desktop/compare/v${CLEAN_VERSION}...HEAD|" CHANGELOG.md
75+
else
76+
# Add unreleased link
77+
if grep -q "^\[${CLEAN_VERSION}\]:" CHANGELOG.md; then
78+
sed -i "/^\[${CLEAN_VERSION}\]:/i [unreleased]: https://github.com/deltachat/deltachat-desktop/compare/v${CLEAN_VERSION}...HEAD" CHANGELOG.md
79+
fi
80+
fi
81+
echo "✅ Updated footer links for ${CLEAN_VERSION}"
82+
fi
83+
elif [ -n "$LATEST_TAG" ]; then
84+
# No new version - just update unreleased link
85+
if grep -q "^\[unreleased\]:" CHANGELOG.md; then
86+
sed -i "s|^\[unreleased\]:.*|[unreleased]: https://github.com/deltachat/deltachat-desktop/compare/${LATEST_TAG}...HEAD|" CHANGELOG.md
87+
echo "✅ Updated [unreleased] link"
88+
fi
89+
fi
90+
91+
echo "✅ Changelog updated!"

0 commit comments

Comments
 (0)