diff --git a/.github/workflows/changelog-v3.yml b/.github/workflows/changelog-v3.yml deleted file mode 100644 index cacbb5a75..000000000 --- a/.github/workflows/changelog-v3.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Changelog V3 - -on: - workflow_dispatch: - inputs: - pr_number: - description: 'PR number' - required: true - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 - with: - go-version: '1.23' - - name: Validate - run: | - echo "PR: ${{ github.event.inputs.pr_number }}" - if [ -f "v3/scripts/validate-changelog.go" ]; then - echo "Script found" - else - echo "Script not found" - fi \ No newline at end of file diff --git a/v3/tasks/release/release.go b/v3/tasks/release/release.go index 18ebe29e7..dc584a570 100644 --- a/v3/tasks/release/release.go +++ b/v3/tasks/release/release.go @@ -9,9 +9,12 @@ import ( ) const ( - versionFile = "../../internal/version/version.txt" + versionFile = "../../internal/version/version.txt" + changelogFile = "../../../docs/src/content/docs/changelog.mdx" +) + +var ( unreleasedChangelogFile = "../../UNRELEASED_CHANGELOG.md" - changelogFile = "../../../docs/src/content/docs/changelog.mdx" ) func checkError(err error) { @@ -401,19 +404,19 @@ func main() { fmt.Printf("Error: No changelog content found in UNRELEASED_CHANGELOG.md\n") os.Exit(1) } - + // Create release_notes.md file releaseNotesPath := "../../release_notes.md" if len(os.Args) > 2 { releaseNotesPath = os.Args[2] } - + err = os.WriteFile(releaseNotesPath, []byte(changelogContent), 0o644) if err != nil { fmt.Printf("Error: Failed to write release notes to %s: %v\n", releaseNotesPath, err) os.Exit(1) } - + fmt.Printf("Successfully created release notes at %s\n", releaseNotesPath) os.Exit(0) } diff --git a/v3/tasks/release/release_test.go b/v3/tasks/release/release_test.go index 9f232c8fc..e598446fc 100644 --- a/v3/tasks/release/release_test.go +++ b/v3/tasks/release/release_test.go @@ -39,120 +39,6 @@ func setupTestEnvironment(t *testing.T) (cleanup func(), projectRoot string) { return cleanup, projectRoot } -func TestExtractChangelogContent(t *testing.T) { - cleanup, _ := setupTestEnvironment(t) - defer cleanup() - - // Create a test file with mixed content - testContent := `# Unreleased Changes - - - -## Added -- Add support for custom window icons in application options -- Add new SetWindowIcon() method to runtime API (#1234) - -## Changed - - -## Fixed -- Fix memory leak in event system during window close operations (#5678) -- Fix crash when using context menus on Linux with Wayland - -## Deprecated - - -## Removed - - -## Security - - ---- - -### Example Entries: - -**Added:** -- Add support for custom window icons in application options -- Add new ` + "`SetWindowIcon()`" + ` method to runtime API (#1234) - -**Changed:** -- Update minimum Go version requirement to 1.21` - - err := os.WriteFile(unreleasedChangelogFile, []byte(testContent), 0o644) - if err != nil { - t.Fatalf("Failed to create test file: %v", err) - } - - // Extract the content - content, err := extractChangelogContent() - if err != nil { - t.Fatalf("extractChangelogContent() failed: %v", err) - } - - // Verify we got content - if content == "" { - t.Fatal("Expected to extract content, but got empty string") - } - - // Verify section headers WITH CONTENT are included - if !strings.Contains(content, "## Added") { - t.Error("Expected to find '## Added' section header") - } - - if !strings.Contains(content, "## Fixed") { - t.Error("Expected to find '## Fixed' section header") - } - - // Verify empty sections are NOT included - if strings.Contains(content, "## Changed") { - t.Error("Expected NOT to find empty '## Changed' section header") - } - - if strings.Contains(content, "## Deprecated") { - t.Error("Expected NOT to find empty '## Deprecated' section header") - } - - if strings.Contains(content, "## Removed") { - t.Error("Expected NOT to find empty '## Removed' section header") - } - - if strings.Contains(content, "## Security") { - t.Error("Expected NOT to find empty '## Security' section header") - } - - // Verify actual content is included - if !strings.Contains(content, "Add support for custom window icons") { - t.Error("Expected to find actual Added content") - } - - if !strings.Contains(content, "Fix memory leak in event system") { - t.Error("Expected to find actual Fixed content") - } - - // Verify example content is NOT included - if strings.Contains(content, "Update minimum Go version requirement to 1.21") { - t.Error("Expected NOT to find example content") - } - - // Verify comments are NOT included - if strings.Contains(content, "") { - t.Error("Expected NOT to find HTML comments") - } - - // Verify the separator and example header are NOT included - if strings.Contains(content, "---") { - t.Error("Expected NOT to find separator") - } - - if strings.Contains(content, "### Example Entries") { - t.Error("Expected NOT to find example section header") - } -} - func TestExtractChangelogContent_EmptySections(t *testing.T) { cleanup, _ := setupTestEnvironment(t) defer cleanup() @@ -365,50 +251,6 @@ func TestGetUnreleasedChangelogTemplate(t *testing.T) { } } -func TestClearUnreleasedChangelog(t *testing.T) { - cleanup, _ := setupTestEnvironment(t) - defer cleanup() - - // Create a test file with some content - testContent := `# Unreleased Changes - -## Added -- Some test content -- Another test item - -## Fixed -- Fixed something important` - - err := os.WriteFile(unreleasedChangelogFile, []byte(testContent), 0o644) - if err != nil { - t.Fatalf("Failed to create test file: %v", err) - } - - // Clear the changelog - err = clearUnreleasedChangelog() - if err != nil { - t.Fatalf("clearUnreleasedChangelog() failed: %v", err) - } - - // Read the file back and verify it contains the template - content, err := os.ReadFile(unreleasedChangelogFile) - if err != nil { - t.Fatalf("Failed to read cleared file: %v", err) - } - - contentStr := string(content) - template := getUnreleasedChangelogTemplate() - - if contentStr != template { - t.Error("Cleared file does not match template") - } - - // Verify the original content is gone - if strings.Contains(contentStr, "Some test content") { - t.Error("Original content still present after clearing") - } -} - func TestHasUnreleasedContent_WithContent(t *testing.T) { cleanup, _ := setupTestEnvironment(t) defer cleanup()