Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow release based on git hash #241

Merged
merged 1 commit into from
Oct 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions cmd/dev/release/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"regexp"
"strings"

"github.com/ory/x/randx"

"github.com/Masterminds/semver/v3"
"github.com/spf13/cobra"

Expand All @@ -18,14 +20,15 @@ import (
var isTestRelease = regexp.MustCompile(`^(([a-zA-Z0-9\.\-]+\.)|)pre\.[0-9]+$`)

var publish = &cobra.Command{
Use: "publish [version]",
Args: cobra.ExactArgs(1),
Use: "publish [version] [git-hash]",
Args: cobra.RangeArgs(1, 2),
Short: "Publish a new release",
Long: `Publishes a new release. Performs git magic and other automated tasks such as tagging the example applications for ORY Kratos and ORY Hydra as well.

To publish a release, you first have to create a pre-release:

ory dev release publish v0.1.0-pre.0
ory dev release publish v0.1.0-pre.0

Once the release pipeline finished successfully (skip publishing the newsletter!) you can run:

Expand All @@ -39,6 +42,10 @@ Here are some examples how to choose pre:
- v0.1.0-alpha.1.pre.0 -> v0.1.0-alpha.1
- v0.1.0-rc.1.pre.0 -> v0.1.0-rc.1

You may also release a specific commit by using its hash as the second argument:

ory dev release publish v0.1.0-pre.0 28472a9f15457f55ae18aee2c5d26a18c1216a39

In case where the release pipeline failed and you re-create another release where you want to include the changelog from the failed release, perform the following:

1. Assuming release "v0.1.0" failed
Expand All @@ -52,7 +59,11 @@ In case where the release pipeline failed and you re-create another release wher
pkg.Check(err)

dry := flagx.MustGetBool(cmd, "dry")

gitCleanTags()
if len(args) == 2 {
pkg.Check(pkg.NewCommand("git", "checkout", "-b", randx.MustString(8, randx.AlphaLowerNum), args[2]).Run())
}

var latestTag string
if cfg.IgnoreTags != nil && len(cfg.IgnoreTags.String()) > 0 {
Expand Down