Skip to content

Commit

Permalink
chore: add back magefile for release task (#3218)
Browse files Browse the repository at this point in the history
* chore: add back magefile for release task

Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>

* chore: fix changelog update

---------

Signed-off-by: Mark Phelps <209477+markphelps@users.noreply.github.com>
  • Loading branch information
markphelps authored Jun 26, 2024
1 parent de136dc commit b396b9a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
33 changes: 33 additions & 0 deletions build/magefile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//go:build mage
// +build mage

package main

import (
"context"

"github.com/magefile/mage/mg"
"go.flipt.io/build/release"
)

type Release mg.Namespace

func (r Release) Next(ctx context.Context, module, versionParts string) error {
return release.Next(module, versionParts)
}

func (r Release) Latest(ctx context.Context, module string) error {
return release.Latest(module, false)
}

func (r Release) LatestRC(ctx context.Context, module string) error {
return release.Latest(module, true)
}

func (r Release) Changelog(ctx context.Context, module, version string) error {
return release.UpdateChangelog(module, version)
}

func (r Release) Tag(ctx context.Context, module, version string) error {
return release.Tag(ctx, module, version)
}
11 changes: 3 additions & 8 deletions build/release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func UpdateChangelog(module, version string) error {
messages := strings.Split(strings.TrimSpace(string(out)), "\n")

return insertChangeLogEntryIntoFile(
path.Join(prefix, "CHANGELOG.md"),
path.Join(prefix, "..", "CHANGELOG.md"),
parseChangeLogVersion(prefix, version, time.Now(), messages...),
)
}
Expand Down Expand Up @@ -205,12 +205,7 @@ func ensureVersionAfter(requested, latest string) error {
return nil
}

func tagModule(ctx context.Context, module, version string) error {
const (
owner = "flipt-io"
repo = "flipt"
)

func tagModule(_ context.Context, module, version string) error {
prefix, err := moduleTagPrefix(module)
if err != nil {
return err
Expand Down Expand Up @@ -279,7 +274,7 @@ func latestRelease(module string, includePre bool) (prefix string, version strin
return
}

repo, err := git.PlainOpen(".")
repo, err := git.PlainOpen("../.")
if err != nil {
return "", "", err
}
Expand Down

0 comments on commit b396b9a

Please sign in to comment.