@@ -79,7 +79,6 @@ func push(cfg *config.PushConfig) error {
7979 }
8080
8181 newHashes := make (map [string ]string )
82- uploaded := false
8382
8483 // Process each certificate
8584 for certName , files := range certFiles {
@@ -105,10 +104,10 @@ func push(cfg *config.PushConfig) error {
105104 s3FileName := fileName + ".enc"
106105 s3Key := s3client .BuildKey (cfg .S3 .Prefix , s3FileName )
107106
108- newHashes [s3FileName ] = localHashStr
107+ newHashes [fileName ] = localHashStr
109108
110109 // Check if hash matches
111- if existingHash , ok := existingHashes [s3FileName ]; ok && existingHash == localHashStr {
110+ if existingHash , ok := existingHashes [fileName ]; ok && existingHash == localHashStr {
112111 continue
113112 }
114113
@@ -128,13 +127,25 @@ func push(cfg *config.PushConfig) error {
128127 return fmt .Errorf ("upload %s to S3: %w" , s3Key , err )
129128 }
130129
131- uploaded = true
132130 log .Printf ("uploaded %s" , s3Key )
133131 }
134132 }
135133
136- // Upload updated hashes file if anything changed
137- if uploaded {
134+ // Check if hashes changed
135+ hashesChanged := false
136+ if len (newHashes ) != len (existingHashes ) {
137+ hashesChanged = true
138+ } else {
139+ for k , v := range newHashes {
140+ if existingHashes [k ] != v {
141+ hashesChanged = true
142+ break
143+ }
144+ }
145+ }
146+
147+ // Upload updated hashes file if it changed
148+ if hashesChanged {
138149 hashesJSON , err := json .Marshal (newHashes )
139150 if err != nil {
140151 return fmt .Errorf ("marshal hashes: %w" , err )
0 commit comments