Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changes/0.10.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## git-grab 0.10.0 (2026-05-30)

### Features

- Add parsing to match the CodeBerg ssh clone string format. (#53)
- Zig 0.16.0
Add support for zig 0.16.0 (#63)
- Allow the shallow clone of repos, forces a depth of one, by setting the `-S/--shallow` flag. (#68)

### Removals

- Support for windows.
Saddly to support windows is going to take more effort. That effort is not currently justified.

### Misc

- Updated the build system to make use of the zon file reading. (#51)
- Update precommit configuration to include running zig test at commit time
- Updated the towncrier configuration to allows show the contains of the misc fragments.
22 changes: 22 additions & 0 deletions .changes/0.7.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## git-grab 0.7.0 (2025-03-22)

### Features

- Update the version display to use built in features (#18)
- Configuration of MyPy, now there is strict types (#26)

### Bugfixes

- Fix fetch on origin not being configured during the initial setup (#23)

### Improved Documentation

- Configure towncrier for the changelog (#12)

### Deprecations and Removals

- Remove support for python 3.8 (#20)

### Misc

- #13, #14, #19
15 changes: 15 additions & 0 deletions .changes/0.8.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## git-grab 0.8.0 (2026-01-24)

### Features

- Toggle from worktrees to standard clone

Allow the user with the `-s` to switch from a worktree configuration clone to a standard clone. (#15)
- Zig Port

This version of git grab moves the python based version to a zig version. (#41)
- Configure towncrier for zig project (#42)

### Misc

- #25, #43
19 changes: 19 additions & 0 deletions .changes/0.9.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## git-grab 0.9.0 (2026-01-31)

### Features

- Adding of logger.
All user facing massages are now logs that go to standard error.
The level of these logs can be adjusted as required, with the default level being info.
To do this the `--log-level` flag has being added. (#45)

### Bugfixes

- Unhandled error was found when the clone path had an existing non worktree project.
A fatal crash would happen due to the `.git` existing.
This is now handled gracefully.

### Misc

- Change data structure for towncrier
- Rework the release system. Now calling `zig build release` will build the cross-platform resources.
6 changes: 6 additions & 0 deletions .changes/header.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog git-grab
All notable changes to [git-grab](https://github.com/Boomatang/git-grab/releases) will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
File renamed without changes.
3 changes: 3 additions & 0 deletions .changes/unreleased/Changed-20260530-152603.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Changed
body: Changelog manager has been changed to use changie.
time: 2026-05-30T15:26:03.560060514+01:00
26 changes: 26 additions & 0 deletions .changie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
changesDir: .changes
unreleasedDir: unreleased
headerPath: header.tpl.md
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## git-grab {{.Version}} ({{.Time.Format "2006-01-02"}})'
kindFormat: '### {{.Kind}}'
changeFormat: '- {{.Body}}'
kinds:
- label: Added
auto: minor
- label: Changed
auto: major
- label: Deprecated
auto: minor
- label: Removed
auto: major
- label: Fixed
auto: patch
- label: Security
auto: patch
newlines:
afterChangelogHeader: 1
beforeChangelogVersion: 1
endOfVersion: 1
envPrefix: CHANGIE_
17 changes: 7 additions & 10 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,15 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 0

- name: Ensure base branch exists
run: git fetch origin ${{ github.base_ref }}

- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Install dependencies
run: python -m pip install towncrier

- name: Check new fragment exists
run: towncrier check --compare-with "origin/${{ github.base_ref }}"
run: |
if [ -z "$(git diff --name-only --diff-filter=A "origin/${{ github.base_ref }}" -- '.changes/unreleased/*.yaml')" ]; then
echo "No changelog fragment found in .changes/unreleased/"
echo "Run 'zig build changie:add' to create one."
exit 1
fi
35 changes: 20 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,54 @@
# git-grab 0.10.0 (2026-05-30)
# Changelog git-grab
All notable changes to [git-grab](https://github.com/Boomatang/git-grab/releases) will be documented in this file.

## Features
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).


## git-grab 0.10.0 (2026-05-30)

### Features

- Add parsing to match the CodeBerg ssh clone string format. (#53)
- Zig 0.16.0
Add support for zig 0.16.0 (#63)
- Allow the shallow clone of repos, forces a depth of one, by setting the `-S/--shallow` flag. (#68)

## Removals
### Removals

- Support for windows.
Saddly to support windows is going to take more effort. That effort is not currently justified.

## Misc
### Misc

- Updated the build system to make use of the zon file reading. (#51)
- Update precommit configuration to include running zig test at commit time
- Updated the towncrier configuration to allows show the contains of the misc fragments.

## git-grab 0.9.0 (2026-01-31)

# git-grab 0.9.0 (2026-01-31)

## Features
### Features

- Adding of logger.
All user facing massages are now logs that go to standard error.
The level of these logs can be adjusted as required, with the default level being info.
To do this the `--log-level` flag has being added. (#45)

## Bugfixes
### Bugfixes

- Unhandled error was found when the clone path had an existing non worktree project.
A fatal crash would happen due to the `.git` existing.
This is now handled gracefully.

## Misc
### Misc

- Change data structure for towncrier
- Rework the release system. Now calling `zig build release` will build the cross-platform resources.

## git-grab 0.8.0 (2026-01-24)

# git-grab 0.8.0 (2026-01-24)

## Features
### Features

- Toggle from worktrees to standard clone

Expand All @@ -52,12 +58,11 @@
This version of git grab moves the python based version to a zig version. (#41)
- Configure towncrier for zig project (#42)

## Misc
### Misc

- #25, #43


# Git_Grab 0.7.0 (2025-03-22)
## git-grab 0.7.0 (2025-03-22)

### Features

Expand Down
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,29 @@ All matching is case-sensitive, which can be problematic when adding remotes.
### Creating the changelog

On new changes a news fragment is required.
This can be created by and news fragments to the `changes` directory.
These files are should have the following naming schema `<issue id>.<feature|bugfix|dic|removal|misc>`.
Using `towncrier create -c "change message" <file name>` will also create the file for you in the correct location.
Create one interactively with:
```
zig build changie:add
```
This places a YAML fragment in `.changes/unreleased/`.
The available change kinds are: `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`.

### Release workflow
1. Ensure the version in `build.zig.zon` is correct for this release.
2. Generate the changelog for the release (review it before proceeding):
2. Batch the unreleased fragments into a versioned changelog file:
```
zig build changie:batch
```
3. Review the generated file in `.changes/` for the release version.
4. Merge all versioned changelogs into `CHANGELOG.md`:
```
zig build changelog_release
zig build changie:merge
```
3. Review the contents of `CHANGELOG.md` for the release version.
4. Commit changes
5. Build release artifacts:
5. Commit changes.
6. Build release artifacts:
```
zig build release
```
6. Create a GitHub release for the current commit with the release version as the tag.
7. Create a GitHub release for the current commit with the release version as the tag.
- Release notes should be the changelog entry for that version.
- Attach all artifacts from `dist/` to the GitHub release.
89 changes: 56 additions & 33 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const std = @import("std");
const zon = @import("build.zig.zon");

// Although this function looks imperative, it does not perform the build
// directly and instead it mutates the build graph (`b`) that will be then
Expand All @@ -25,7 +26,6 @@ pub fn build(b: *std.Build) void {
const options = b.addOptions();

// Read version and name form build.zig.zon
const zon = @import("build.zig.zon");
const name_str = @tagName(zon.name);
const version = zon.version;

Expand Down Expand Up @@ -161,25 +161,6 @@ pub fn build(b: *std.Build) void {
test_step.dependOn(&run_mod_tests.step);
test_step.dependOn(&run_exe_tests.step);

const changelog_cmd = b.addSystemCommand(&.{
"towncrier",
"build",
"--draft",
"--version",
version,
});
const changelog_step = b.step("changelog_draft", "Build changelog draft");
changelog_step.dependOn(&changelog_cmd.step);

const changelog_release_cmd = b.addSystemCommand(&.{
"towncrier",
"build",
"--version",
version,
});
const changelog_release_step = b.step("changelog_release", "Build changelog release");
changelog_release_step.dependOn(&changelog_release_cmd.step);

const release_step = b.step("release", "Build release archives");

const release_checks = ReleaseChecksStep.create(b, version);
Expand Down Expand Up @@ -262,6 +243,40 @@ pub fn build(b: *std.Build) void {
//
// Lastly, the Zig build system is relatively simple and self-contained,
// and reading its source code will allow you to master it.

// Set Up Changie Commands
// WARNING: build() returns early here if changie deps are not fetched.
// Do NOT add build steps after the changie block — they will be silently hidden.
const changie_bin = get_changie_bin(b) orelse return;

// Changie Add
const changie_add = std.Build.Step.Run.create(b, "run changie");
changie_add.addFileArg(changie_bin);
changie_add.addArg("new");
const changie_add_cmd = b.step("changie:add", "Add change log fragment");
changie_add_cmd.dependOn(&changie_add.step);

// Changie batch
const changie_batch = std.Build.Step.Run.create(b, "run changie");
changie_batch.addFileArg(changie_bin);
changie_batch.addArg("batch");
changie_batch.addArg(zon.version);
const changie_batch_cmd = b.step("changie:batch", "Batch fragments for a release");
changie_batch_cmd.dependOn(&changie_batch.step);

// Changie merge
const changie_merge = std.Build.Step.Run.create(b, "run changie");
changie_merge.addFileArg(changie_bin);
changie_merge.addArg("merge");
const changie_merge_cmd = b.step("changie:merge", "Merge all changes into CHANGELOG.md");
changie_merge_cmd.dependOn(&changie_merge.step);

// Changie Version
const changie_version = std.Build.Step.Run.create(b, "run changie");
changie_version.addFileArg(changie_bin);
changie_version.addArg("--version");
const changie_version_cmd = b.step("changie:version", "Print the changie version");
changie_version_cmd.dependOn(&changie_version.step);
}

const ReleaseTarget = struct {
Expand Down Expand Up @@ -341,18 +356,26 @@ fn addReleaseExecutable(
return exe;
}

fn parseVersionFromZon(zon: []const u8) []const u8 {
const needle = ".version = \"";
if (std.mem.indexOf(u8, zon, needle)) |start| {
const version_start = start + needle.len;
if (std.mem.indexOfPos(u8, zon, version_start, "\"")) |end| {
return zon[version_start..end];
}
}

return "unknown";
}
fn get_changie_bin(b: *std.Build) ?std.Build.LazyPath {
const host = b.graph.host.result;
const name = switch (host.os.tag) {
.linux => switch (host.cpu.arch) {
.x86_64 => "changie_linux_amd64",
.aarch64 => "changie_linux_arm64",
else => return null,
},
.macos => switch (host.cpu.arch) {
.x86_64 => "changie_darwin_amd64",
.aarch64 => "changie_darwin_arm64",
else => return null,
},

else => return null,
};

fn changelogDraft() void {
std.debug.print("works", .{});
if (b.lazyDependency(name, .{})) |dep| {
return dep.path("changie");
} else {
return null;
}
}
Loading
Loading