Skip to content

Commit d2b9a19

Browse files
feat: add full tarball to release
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 87e00a9 commit d2b9a19

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

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+
echo gh release create $VERSION -t $VERSION --generate-notes -d "$TMPDIR/$TARBALL_NAME"
63+
64+
# Cleanup
65+
rm -rf "$TMPDIR"

0 commit comments

Comments
 (0)