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
4 changes: 2 additions & 2 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": "github.com/gojekfarm/xtools",
"baseBranch": "main",
"ignore": null,
"ignorePaths": null,
"ignore": [""],
"ignorePaths": ["examples/*"],
"dependentBump": "patch"
}
5 changes: 5 additions & 0 deletions .changeset/lucky-dove-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"cmd/changeset": patch
---

Remove changelog generation from version command
26 changes: 26 additions & 0 deletions .github/workflows/changeset-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Changeset Check

on:
pull_request:
branches: [main]

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.25.x"

- name: Install changeset
run: go install github.com/gojekfarm/xtools/cmd/changeset@latest

- name: Check for changeset
run: |
changeset status --since=origin/main
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish

on:
push:
branches: [main]
paths:
- ".changeset/release-manifest.json"

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.25.x"

- name: Install changeset
run: go install github.com/gojekfarm/xtools/cmd/changeset@latest

- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Publish
run: changeset publish
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release

on:
push:
branches: [main]
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.25.x"

- name: Install changeset
run: go install github.com/gojekfarm/xtools/cmd/changeset@latest

- name: Check for changesets
id: check
run: |
if compgen -G ".changeset/*.md" > /dev/null 2>&1; then
echo "has_changesets=true" >> $GITHUB_OUTPUT
else
echo "has_changesets=false" >> $GITHUB_OUTPUT
fi

- name: Create Release PR
if: steps.check.outputs.has_changesets == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Configure git
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

# Create release branch
BRANCH="changeset-release/main"
git checkout -B $BRANCH

# Version packages
changeset version

# Check if there are changes to commit
if git diff --quiet; then
echo "No version changes to commit"
exit 0
fi

# Commit changes
git add -A
git commit -m "chore: version packages"
git push -f origin $BRANCH

# Create or update PR
gh pr create --base main --head $BRANCH \
--title "chore: version packages" \
--body "This PR was auto-generated by the release workflow." \
2>/dev/null || gh pr edit $BRANCH --title "chore: version packages"
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ go.work.sum
.cursor/
.tasks/

release-manifest.json
4 changes: 1 addition & 3 deletions cmd/changeset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ $ changeset status

### `changeset version`

Consume changesets, update go.mod files, and generate changelogs.
Consume changesets and update go.mod files.

```bash
$ changeset version
Expand Down Expand Up @@ -154,7 +154,6 @@ main
│ ├── Reads all .changeset/*.md
│ ├── Computes: xkafka v0.10.0 → v0.11.0
│ ├── Updates go.mod files
│ ├── Updates CHANGELOG.md
│ ├── Deletes .changeset/*.md
│ └── Writes .changeset/release-manifest.json
│
Expand Down Expand Up @@ -212,7 +211,6 @@ changeset version
├── Reads .changeset/*.md (changesets)
├── Computes version bumps
├── Updates go.mod files
├── Updates CHANGELOG.md
├── Deletes consumed changesets
└── Writes .changeset/release-manifest.json ← created

Expand Down
2 changes: 1 addition & 1 deletion cmd/changeset/app/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func createChangesetInteractive(dir string) (*changeset.Changeset, error) {
huh.NewGroup(
huh.NewText().
Title("Describe the changes").
Description("This will appear in the changelog").
Description("Summary of the change").
CharLimit(1000).
Value(&summary),
),
Expand Down
4 changes: 2 additions & 2 deletions cmd/changeset/app/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ func BuildStatusCommand() *cli.Command {
func BuildVersionCommand() *cli.Command {
return &cli.Command{
Name: "version",
Usage: "Update versions and changelogs from changesets",
Description: "Consumes all changesets, updates go.mod files, generates changelogs,\n" +
Usage: "Update versions from changesets",
Description: "Consumes all changesets, updates go.mod files,\n" +
"and writes a release manifest for the publish step.\n\n" +
"Examples:\n" +
" changeset version\n" +
Expand Down
26 changes: 2 additions & 24 deletions cmd/changeset/app/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,30 +113,8 @@ func Version(ctx context.Context, cmd *cli.Command) error {
slog.Info("Updated go.mod", "path", gomodPath)
}

// Update changelogs for each released module (skip for snapshots)
// Delete consumed changesets (skip for snapshots)
if !snapshot {
slog.Info("Updating changelogs")
for _, r := range releases {
mod := graph.FindModule(r.Module)
if mod == nil {
continue
}

// Generate changelog entry for this module
entry := changeset.GenerateChangelog([]changeset.Release{r}, changesets)
if entry == nil {
continue
}

changelogPath := filepath.Join(mod.Path, "CHANGELOG.md")
if err := changeset.UpdateChangelog(changelogPath, entry); err != nil {
return cli.Exit(fmt.Sprintf("Failed to update changelog for %s: %v", r.Module, err), 1)
}

slog.Info("Updated changelog", "path", changelogPath, "module", displayModule(r.Module))
}

// Delete consumed changesets (skip for snapshots)
slog.Info("Deleting consumed changesets")
for _, cs := range changesets {
if err := changeset.DeleteChangeset(cs); err != nil {
Expand All @@ -146,7 +124,7 @@ func Version(ctx context.Context, cmd *cli.Command) error {
}
}
} else {
slog.Info("Snapshot mode: Skipping changelog updates and changeset deletion")
slog.Info("Snapshot mode: Skipping changeset deletion")
}

// Write release manifest
Expand Down
Loading