mirror of
https://github.com/apricote/releaser-pleaser.git
synced 2026-02-11 12:17:04 +00:00
Compare commits
12 commits
09436afe81
...
1488ecd301
| Author | SHA1 | Date | |
|---|---|---|---|
| 1488ecd301 | |||
| 467adbe752 | |||
| 589fdde401 | |||
| 6f616f9923 | |||
| ffcc3b60cb | |||
| 08e7b31eff | |||
| 69796325c7 | |||
| 0c93645b21 | |||
| fbd47fac62 | |||
| 5882a6bf2c | |||
| f2a982d7a0 | |||
| 32734d9aa1 |
3 changed files with 17 additions and 2 deletions
|
|
@ -31,7 +31,7 @@ func init() {
|
|||
runCmd.PersistentFlags().StringVar(&flagBranch, "branch", "main", "")
|
||||
runCmd.PersistentFlags().StringVar(&flagOwner, "owner", "", "")
|
||||
runCmd.PersistentFlags().StringVar(&flagRepo, "repo", "", "")
|
||||
runCmd.PersistentFlags().StringVar(&flagRepo, "extra-files", "", "")
|
||||
runCmd.PersistentFlags().StringVar(&flagExtraFiles, "extra-files", "", "")
|
||||
}
|
||||
|
||||
func run(cmd *cobra.Command, _ []string) error {
|
||||
|
|
|
|||
|
|
@ -277,6 +277,19 @@ func (rp *ReleaserPleaser) runReconcileReleasePR(ctx context.Context) error {
|
|||
updatedContent = updater.UpdateContent(updatedContent, nextVersion)
|
||||
}
|
||||
|
||||
err = file.Truncate(0)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to replace file content: %w", err)
|
||||
}
|
||||
_, err = file.Seek(0, 0)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to replace file content: %w", err)
|
||||
}
|
||||
_, err = file.Write([]byte(updatedContent))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to replace file content: %w", err)
|
||||
}
|
||||
|
||||
_, err = worktree.Add(extraFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to add updated file to git worktree: %w", err)
|
||||
|
|
|
|||
|
|
@ -25,10 +25,12 @@ func (u *GenericUpdater) UpdateContent(content, version string) string {
|
|||
output.Grow(len(content))
|
||||
for _, line := range strings.Split(content, "\n") {
|
||||
if strings.Contains(line, InlineUpdateMarker) {
|
||||
line = SemVerRegex.ReplaceAllLiteralString(line, version)
|
||||
// We strip the "v" prefix to avoid adding/removing it from the users input.
|
||||
line = SemVerRegex.ReplaceAllLiteralString(line, strings.TrimPrefix(version, "v"))
|
||||
}
|
||||
|
||||
output.WriteString(line)
|
||||
// TODO: Fix added newline
|
||||
output.WriteByte('\n')
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue