-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added changelog to newly support Rust release
- Loading branch information
Showing
8 changed files
with
159 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,3 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/streamingfast/cli" | ||
) | ||
|
||
func releaseGolang(allowDirty bool, envFilePath string, releaseNotesPath string) { | ||
if devSkipGoreleaser { | ||
return | ||
} | ||
|
||
golangCrossVersion := "v1.20.2" | ||
arguments := []string{ | ||
"docker", | ||
|
||
// docker arguments | ||
"run", | ||
"--rm", | ||
"-e CGO_ENABLED=1", | ||
"--env-file", envFilePath, | ||
"-v /var/run/docker.sock:/var/run/docker.sock", | ||
"-v", cli.WorkingDirectory() + ":/go/src/work", | ||
"-w /go/src/work", | ||
"goreleaser/goreleaser-cross:" + golangCrossVersion, | ||
|
||
// goreleaser arguments | ||
"--timeout=60m", | ||
"--rm-dist", | ||
"--release-notes=" + releaseNotesPath, | ||
} | ||
|
||
if allowDirty { | ||
arguments = append(arguments, "--skip-validate") | ||
} | ||
|
||
fmt.Println() | ||
run(arguments...) | ||
} | ||
var releaseGolangGitHub = releaseGithub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,78 @@ | ||
package main | ||
|
||
import "github.com/streamingfast/cli" | ||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
|
||
func releaseRustPublishCrates(rust *RustReleaseModel) { | ||
if devSkipRustCargoPublish { | ||
return | ||
"github.com/streamingfast/cli" | ||
) | ||
|
||
func releaseRustGitHub(global *GlobalModel, allowDirty bool, envFilePath string, releaseNotesPath string) { | ||
buildDirectory := "build" | ||
goreleaserPath := filepath.Join(buildDirectory, "goreleaser.yaml") | ||
|
||
cli.NoError(os.MkdirAll(buildDirectory, os.ModePerm), `Unable to create %q directory`, buildDirectory) | ||
|
||
goreleaserTemplate := goreleaserAppTmpl | ||
if global.Variant == VariantLibrary { | ||
goreleaserTemplate = goreleaserLibTmpl | ||
} | ||
|
||
renderTemplate(goreleaserPath, true, goreleaserTemplate, getInstallTemplateModel(global)) | ||
|
||
releaseGithub(goreleaserPath, allowDirty, envFilePath, releaseNotesPath) | ||
} | ||
|
||
func printRustCratesNotPublishedMessage(rust *RustReleaseModel) { | ||
cli.Ensure(rust != nil, "Rust model should have been populated by now but it's currently nil") | ||
|
||
fmt.Println(dedent(` | ||
Since release is not published yet, we have not perform crates publishing to crates.io | ||
repository. Once the release is published, you will need afterward to publish the crates | ||
manually. | ||
Here the command you need to perform to publish your crate(s): | ||
`)) | ||
|
||
fmt.Println() | ||
for _, crate := range rust.Crates { | ||
args := []string{"cargo publish"} | ||
args = append(args, rust.CargoPublishArgs...) | ||
args = append(args, "-p", crate) | ||
fmt.Println(" ", publishRustCrateCommand(crate, rust.CargoPublishArgs)) | ||
} | ||
|
||
fmt.Println() | ||
fmt.Println(dedent(` | ||
It's important to run them strictly in the order printed above, otherwise publishing will fail. | ||
Also, ensure that you are on the published tag before doing the 'cargo publish' commands, to | ||
be 100%% your are releasing the crates from the correct commit. | ||
`)) | ||
} | ||
|
||
run(args...) | ||
func releaseRustPublishCrates(rust *RustReleaseModel) { | ||
cli.Ensure(rust != nil, "Rust model should have been populated by now but it's currently nil") | ||
|
||
if devSkipRustCargoPublish { | ||
return | ||
} | ||
|
||
for _, crate := range rust.Crates { | ||
run(publishRustCrateArgs(crate, rust.CargoPublishArgs)...) | ||
} | ||
} | ||
|
||
func publishRustCrateArgs(crate string, publishArgs []string) []string { | ||
args := []string{"cargo publish"} | ||
args = append(args, publishArgs...) | ||
args = append(args, "-p", crate) | ||
|
||
return args | ||
} | ||
|
||
func publishRustCrateCommand(crate string, publishArgs []string) string { | ||
args := publishRustCrateArgs(crate, publishArgs) | ||
|
||
return strings.Join(unquotedFlatten(args...), " ") | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
global: | ||
language: {{ .language }} | ||
variant: {{ .variant }} | ||
{{- if .rust.Crates }} | ||
release: | ||
# This is the list of Rust crates that are going to be 'cargo publish'. | ||
# **Important** Ordering must be strictly specified so that crates | ||
# are ordered by dependency order, a crate that depends on another | ||
# one should be listed below it's dependency. | ||
# | ||
# The generated values below are **unordered**, you must re-order them! | ||
rust-crates: | ||
{{- range $crate := .rust.Crates }} | ||
- {{ $crate }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if .rust.Crates }} | ||
release: | ||
# This is the list of Rust crates that are going to be 'cargo publish'. | ||
# **Important** Ordering must be strictly specified so that crates | ||
# are ordered by dependency order, a crate that depends on another | ||
# one should be listed below it's dependency. | ||
# | ||
# The generated values below are **unordered**, you must re-order them! | ||
rust-crates: | ||
{{- range $crate := .rust.Crates }} | ||
- {{ $crate }} | ||
{{- end }} | ||
{{- end }} |