summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-08-16 09:39:09 +0300
committerPaul Buetow <paul@buetow.org>2025-08-16 09:39:09 +0300
commit9603960eeea6b06c5184850c2c2af7d257c77fdd (patch)
treebbf495e79ae12390bb91019a770fe598fbb89785 /internal
parentab561e848dd7ca10497da4ef3cfba9fa02ac48d0 (diff)
feat(release): add repo/tag skip_releases and logs; bump version to 0.8.7v0.8.7
Diffstat (limited to 'internal')
-rw-r--r--internal/cli/release.go110
-rw-r--r--internal/config/config.go34
-rw-r--r--internal/version/version.go2
3 files changed, 107 insertions, 39 deletions
diff --git a/internal/cli/release.go b/internal/cli/release.go
index e05cbdd..848d28a 100644
--- a/internal/cli/release.go
+++ b/internal/cli/release.go
@@ -151,9 +151,9 @@ func HandleCheckReleasesForRepos(cfg *config.Config, flags *Flags, repositories
fmt.Println("No Codeberg organization found in config")
}
- // Process the specified repositories
- for _, repoName := range repositories {
- fmt.Printf("\nChecking releases for repository: %s\n", repoName)
+ // Process the specified repositories
+ for _, repoName := range repositories {
+ fmt.Printf("\nChecking releases for repository: %s\n", repoName)
// Check if the repository is cloned locally
repoPath := filepath.Join(flags.WorkDir, repoName)
@@ -174,41 +174,84 @@ func HandleCheckReleasesForRepos(cfg *config.Config, flags *Flags, repositories
continue
}
- fmt.Printf(" Found %d version tags: %s\n", len(localTags), strings.Join(localTags, ", "))
+ fmt.Printf(" Found %d version tags: %s\n", len(localTags), strings.Join(localTags, ", "))
+ // Log configured skip rules for this repo, if any
+ if cfg.SkipReleases != nil {
+ if skipTags, ok := cfg.SkipReleases[repoName]; ok && len(skipTags) > 0 {
+ fmt.Printf(" Config skip_releases for %s: %s\n", repoName, strings.Join(skipTags, ", "))
+ }
+ }
// Check GitHub releases if GitHub is configured
var missingGitHub []string
githubOrg := cfg.FindGitHubOrg()
- if githubOrg != nil && githubOrg.Name != "" {
- githubReleases, err := releaseManager.GetGitHubReleases(githubOrg.Name, repoName)
- if err != nil {
- fmt.Printf(" Error checking GitHub releases: %v\n", err)
- } else {
- missingGitHub = releaseManager.FindMissingReleases(localTags, githubReleases)
- if len(missingGitHub) > 0 {
- fmt.Printf(" Missing GitHub releases: %s\n", strings.Join(missingGitHub, ", "))
- }
- }
- }
+ if githubOrg != nil && githubOrg.Name != "" {
+ githubReleases, err := releaseManager.GetGitHubReleases(githubOrg.Name, repoName)
+ if err != nil {
+ fmt.Printf(" Error checking GitHub releases: %v\n", err)
+ } else {
+ missingGitHub = releaseManager.FindMissingReleases(localTags, githubReleases)
+ // Filter out tags that should be skipped per config
+ if len(missingGitHub) > 0 {
+ var filtered []string
+ var skipped []string
+ for _, t := range missingGitHub {
+ if cfg.ShouldSkipRelease(repoName, t) {
+ skipped = append(skipped, t)
+ } else {
+ filtered = append(filtered, t)
+ }
+ }
+ if len(skipped) > 0 {
+ fmt.Printf(" Skipping GitHub releases per config for tags: %s\n", strings.Join(skipped, ", "))
+ }
+ missingGitHub = filtered
+ if len(missingGitHub) > 0 {
+ fmt.Printf(" Missing GitHub releases: %s\n", strings.Join(missingGitHub, ", "))
+ }
+ }
+ }
+ }
// Check Codeberg releases if Codeberg is configured
var missingCodeberg []string
codebergOrg := cfg.FindCodebergOrg()
- if codebergOrg != nil && codebergOrg.Name != "" {
- codebergReleases, err := releaseManager.GetCodebergReleases(codebergOrg.Name, repoName)
- if err != nil {
- fmt.Printf(" Error checking Codeberg releases: %v\n", err)
- } else {
- missingCodeberg = releaseManager.FindMissingReleases(localTags, codebergReleases)
- if len(missingCodeberg) > 0 {
- fmt.Printf(" Missing Codeberg releases: %s\n", strings.Join(missingCodeberg, ", "))
- }
- }
- }
+ if codebergOrg != nil && codebergOrg.Name != "" {
+ codebergReleases, err := releaseManager.GetCodebergReleases(codebergOrg.Name, repoName)
+ if err != nil {
+ fmt.Printf(" Error checking Codeberg releases: %v\n", err)
+ } else {
+ missingCodeberg = releaseManager.FindMissingReleases(localTags, codebergReleases)
+ // Filter out tags that should be skipped per config
+ if len(missingCodeberg) > 0 {
+ var filtered []string
+ var skipped []string
+ for _, t := range missingCodeberg {
+ if cfg.ShouldSkipRelease(repoName, t) {
+ skipped = append(skipped, t)
+ } else {
+ filtered = append(filtered, t)
+ }
+ }
+ if len(skipped) > 0 {
+ fmt.Printf(" Skipping Codeberg releases per config for tags: %s\n", strings.Join(skipped, ", "))
+ }
+ missingCodeberg = filtered
+ if len(missingCodeberg) > 0 {
+ fmt.Printf(" Missing Codeberg releases: %s\n", strings.Join(missingCodeberg, ", "))
+ }
+ }
+ }
+ }
// Create missing releases with confirmation
- if len(missingGitHub) > 0 && githubOrg != nil {
- for _, tag := range missingGitHub {
+ if len(missingGitHub) > 0 && githubOrg != nil {
+ for _, tag := range missingGitHub {
+ // Skip if configured to skip this repo/tag
+ if cfg.ShouldSkipRelease(repoName, tag) {
+ fmt.Printf(" Skipping GitHub release for %s:%s per config skip_releases\n", repoName, tag)
+ continue
+ }
// Get commits for this tag
commits, err := releaseManager.GetCommitsSinceTag(repoPath, "", tag)
if err != nil {
@@ -281,8 +324,13 @@ func HandleCheckReleasesForRepos(cfg *config.Config, flags *Flags, repositories
}
}
- if len(missingCodeberg) > 0 && codebergOrg != nil {
- for _, tag := range missingCodeberg {
+ if len(missingCodeberg) > 0 && codebergOrg != nil {
+ for _, tag := range missingCodeberg {
+ // Skip if configured to skip this repo/tag
+ if cfg.ShouldSkipRelease(repoName, tag) {
+ fmt.Printf(" Skipping Codeberg release for %s:%s per config skip_releases\n", repoName, tag)
+ continue
+ }
// Get commits for this tag
commits, err := releaseManager.GetCommitsSinceTag(repoPath, "", tag)
if err != nil {
@@ -564,4 +612,4 @@ func saveAIReleaseNotesCache(cacheFile string, cache map[string]string) error {
// Don't print on every save since we save after each generation
return nil
-} \ No newline at end of file
+}
diff --git a/internal/config/config.go b/internal/config/config.go
index 86c474f..dce5526 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -19,11 +19,14 @@ type Organization struct {
// Config holds the application configuration
type Config struct {
- Organizations []Organization `json:"organizations"`
- Repositories []string `json:"repositories,omitempty"`
- ExcludeBranches []string `json:"exclude_branches,omitempty"` // Regex patterns for branches to exclude
- WorkDir string `json:"work_dir,omitempty"` // Working directory for cloning repositories
- ExcludeFromShowcase []string `json:"exclude_from_showcase,omitempty"` // Repository names to exclude from showcase
+ Organizations []Organization `json:"organizations"`
+ Repositories []string `json:"repositories,omitempty"`
+ ExcludeBranches []string `json:"exclude_branches,omitempty"` // Regex patterns for branches to exclude
+ WorkDir string `json:"work_dir,omitempty"` // Working directory for cloning repositories
+ ExcludeFromShowcase []string `json:"exclude_from_showcase,omitempty"` // Repository names to exclude from showcase
+ // SkipReleases maps a repository name to a list of tag names for which
+ // releases should NOT be created on any platform (GitHub/Codeberg)
+ SkipReleases map[string][]string `json:"skip_releases,omitempty"`
}
// Load reads and parses the configuration file
@@ -99,7 +102,25 @@ func (c *Config) Validate() error {
}
}
- return nil
+ return nil
+}
+
+// ShouldSkipRelease returns true if the configuration specifies that
+// the given repo/tag combination should not have a release created.
+func (c *Config) ShouldSkipRelease(repo, tag string) bool {
+ if c == nil || c.SkipReleases == nil {
+ return false
+ }
+ tags, ok := c.SkipReleases[repo]
+ if !ok {
+ return false
+ }
+ for _, t := range tags {
+ if t == tag {
+ return true
+ }
+ }
+ return false
}
// GetGitURL returns the git URL for an organization
@@ -157,4 +178,3 @@ func (o *Organization) IsSSH() bool {
return !o.IsGitHub() && !o.IsCodeberg() && !strings.HasPrefix(o.Host, "file://") &&
(strings.Contains(o.Host, "@") || strings.Contains(o.Host, ":"))
}
-
diff --git a/internal/version/version.go b/internal/version/version.go
index efce7d6..93b9ce8 100644
--- a/internal/version/version.go
+++ b/internal/version/version.go
@@ -7,7 +7,7 @@ import (
var (
// Version is the current version of gitsyncer
- Version = "0.8.6"
+ Version = "0.8.7"
// GitCommit is the git commit hash at build time
GitCommit = "unknown"