Skip to content

Commit 080bb76

Browse files
feat: update release process to add full tarball
Github asset does not contain submodule code, we manually create the git archive with all submodules sources checked out to be used as a self contained bazel module.
1 parent f862580 commit 080bb76

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Release
44

5-
For now, releasing is done manually, by tagging a git rev with vX.Y.Z.
5+
To create a release, follow these steps:
66

7-
When releasing a new version, please make sure the version is updated in the [`core/CMakeLists.txt`](https://github.com/CodSpeedHQ/codspeed-cpp/blob/main/core/CMakeLists.txt#L3) and [`core/BUILD`](https://github.com/CodSpeedHQ/codspeed-cpp/blob/main/core/BUILD#L4) files to match the pushed version
7+
1. Update the version in the following locations to the new version:
8+
- [`core/CMakeLists.txt`](https://github.com/CodSpeedHQ/codspeed-cpp/blob/main/core/CMakeLists.txt#L3)
9+
- [`core/MODULE.bazel`](https://github.com/CodSpeedHQ/codspeed-cpp/blob/main/core/MODULE.bazel#3)
10+
- [`google_benchmark/MODULE.bazel` module's version](https://github.com/CodSpeedHQ/codspeed-cpp/blob/main/google_benchmark/MODULE.bazel#L3)
11+
- [`google_benchmark/MODULE.bazel` core dependency version](https://github.com/CodSpeedHQ/codspeed-cpp/blob/main/google_benchmark/MODULE.bazel#L6)
12+
2. Once the version changes are merged on main, run `scripts/release.sh <new_version>` to tag and create the release on GitHub.

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
commonBuildInputs = with pkgs; [
2222
gcc
2323
pkg-config
24+
git-cliff
2425

2526
# Build systems
2627
cmake

scripts/release.sh

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,42 @@ if [ -z "$GITHUB_TOKEN" ]; then
2424

2525
fi
2626

27+
# Make sure submodules are up to date
28+
git submodule update --init --recursive
29+
30+
# Check that no uncommitted changes exist
31+
if [ -n "$(git status --porcelain)" ]; then
32+
echo "Uncommitted changes exist. Please commit or stash them before creating a release."
33+
exit 1
34+
fi
35+
2736
git cliff -o CHANGELOG.md --tag $VERSION --github-token $GITHUB_TOKEN
2837
git add CHANGELOG.md
2938
git commit -m "chore: Release $VERSION"
3039
git tag $VERSION -m "Release $VERSION"
3140
git push origin main
3241
git push origin $VERSION
33-
gh release create $VERSION -t $VERSION --generate-notes -d
42+
43+
# Create tarball with submodules included
44+
echo "Creating release tarball with submodules..."
45+
TMPDIR=$(mktemp -d)
46+
ARCHIVE_NAME="codspeed-cpp-${VERSION}"
47+
TARBALL_NAME="${ARCHIVE_NAME}.tar.gz"
48+
49+
# Create main archive
50+
git archive --prefix="${ARCHIVE_NAME}/" --format=tar HEAD | \
51+
(cd "$TMPDIR" && tar xf -)
52+
53+
# Add submodule content
54+
git submodule foreach --recursive "git archive --prefix=${ARCHIVE_NAME}/\$path/ --format=tar HEAD | (cd $TMPDIR && tar xf -)"
55+
56+
# Create final tarball
57+
(cd "$TMPDIR" && tar czf "$TMPDIR/$TARBALL_NAME" "$ARCHIVE_NAME")
58+
59+
echo "Tarball created at: $TMPDIR/$TARBALL_NAME"
60+
61+
# Create GitHub release with the tarball
62+
gh release create $VERSION -t $VERSION --generate-notes -d "$TMPDIR/$TARBALL_NAME"
63+
64+
# Cleanup
65+
rm -rf "$TMPDIR"

0 commit comments

Comments
 (0)