Skip to content

Commit

Permalink
fix(release): properly set versions after import path change (#225)
Browse files Browse the repository at this point in the history
Once we changed to `v2`, we needed to also update the goreleaser
configuration to reflect the new import path, which was not done.
  • Loading branch information
jaredallard authored Jan 5, 2025
1 parent 7bf47f4 commit ccc083c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
10 changes: 5 additions & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ builds:
- -s
- -w
## <<Stencil::Block(stencilLdflags)>>
- -X go.rgst.io/stencil/internal/version.version={{.Version}}
- -X go.rgst.io/stencil/internal/version.commit={{.Commit}}
- -X go.rgst.io/stencil/internal/version.date={{ .CommitDate }}
- -X go.rgst.io/stencil/internal/version.builtBy=goreleaser
- -X go.rgst.io/stencil/internal/version.treeState={{ if .IsGitDirty }}dirty{{ else }}clean{{ end }}
- -X go.rgst.io/stencil/v2/internal/version.version={{.Version}}
- -X go.rgst.io/stencil/v2/internal/version.commit={{.Commit}}
- -X go.rgst.io/stencil/v2/internal/version.date={{ .CommitDate }}
- -X go.rgst.io/stencil/v2/internal/version.builtBy=goreleaser
- -X go.rgst.io/stencil/v2/internal/version.treeState={{ if .IsGitDirty }}dirty{{ else }}clean{{ end }}
## <</Stencil::Block>>
env:
- CGO_ENABLED=0
Expand Down
2 changes: 1 addition & 1 deletion pkg/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ type TemplateRepository struct {
//
// Version can also be a constraint as supported by the underlying
// resolver:
// https://pkg.go.dev/go.rgst.io/stencil/internal/modules/resolver
// https://pkg.go.dev/go.rgst.io/stencil/v2/internal/modules/resolver
//
// But note that constraints are currently not locked so the version
// will change as the module is resolved on subsequent runs.
Expand Down
4 changes: 2 additions & 2 deletions schemas/manifest.jsonschema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft-07/schema#",
"$id": "https://go.rgst.io/stencil/pkg/configuration/template-repository-manifest",
"$id": "https://go.rgst.io/stencil/v2/pkg/configuration/template-repository-manifest",
"$ref": "#/$defs/TemplateRepositoryManifest",
"$defs": {
"Argument": {
Expand Down Expand Up @@ -65,7 +65,7 @@
},
"version": {
"type": "string",
"description": "Version is a semantic version or branch of the template repository\nthat should be downloaded if not set then the latest version is used.\n\nVersion can also be a constraint as supported by the underlying\nresolver:\nhttps://pkg.go.dev/go.rgst.io/stencil/internal/modules/resolver\n\nBut note that constraints are currently not locked so the version\nwill change as the module is resolved on subsequent runs.\nEventually, this will be changed to use the lockfile by default."
"description": "Version is a semantic version or branch of the template repository\nthat should be downloaded if not set then the latest version is used.\n\nVersion can also be a constraint as supported by the underlying\nresolver:\nhttps://pkg.go.dev/go.rgst.io/stencil/v2/internal/modules/resolver\n\nBut note that constraints are currently not locked so the version\nwill change as the module is resolved on subsequent runs.\nEventually, this will be changed to use the lockfile by default."
}
},
"additionalProperties": false,
Expand Down
4 changes: 2 additions & 2 deletions schemas/stencil.jsonschema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft-07/schema#",
"$id": "https://go.rgst.io/stencil/pkg/configuration/manifest",
"$id": "https://go.rgst.io/stencil/v2/pkg/configuration/manifest",
"$ref": "#/$defs/Manifest",
"$defs": {
"Manifest": {
Expand Down Expand Up @@ -42,7 +42,7 @@
},
"version": {
"type": "string",
"description": "Version is a semantic version or branch of the template repository\nthat should be downloaded if not set then the latest version is used.\n\nVersion can also be a constraint as supported by the underlying\nresolver:\nhttps://pkg.go.dev/go.rgst.io/stencil/internal/modules/resolver\n\nBut note that constraints are currently not locked so the version\nwill change as the module is resolved on subsequent runs.\nEventually, this will be changed to use the lockfile by default."
"description": "Version is a semantic version or branch of the template repository\nthat should be downloaded if not set then the latest version is used.\n\nVersion can also be a constraint as supported by the underlying\nresolver:\nhttps://pkg.go.dev/go.rgst.io/stencil/v2/internal/modules/resolver\n\nBut note that constraints are currently not locked so the version\nwill change as the module is resolved on subsequent runs.\nEventually, this will be changed to use the lockfile by default."
}
},
"additionalProperties": false,
Expand Down
6 changes: 3 additions & 3 deletions tools/schemagen/go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module go.rgst.io/stencil/tools/schemagen
module go.rgst.io/stencil/v2/tools/schemagen

go 1.23.4

replace go.rgst.io/stencil => ../..
replace go.rgst.io/stencil/v2 => ../..

require (
github.com/invopop/jsonschema v0.13.0
go.rgst.io/stencil v0.0.0-00010101000000-000000000000
go.rgst.io/stencil/v2 v2.0.0-00010101000000-000000000000
)

require (
Expand Down
1 change: 1 addition & 0 deletions tools/schemagen/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tools/schemagen/schemagen.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"path/filepath"

"github.com/invopop/jsonschema"
"go.rgst.io/stencil/pkg/configuration"
"go.rgst.io/stencil/v2/pkg/configuration"
)

type schema struct {
Expand Down Expand Up @@ -52,7 +52,7 @@ func main() {
r.FieldNameTag = "yaml"

// Add comments to the schema.
if err := r.AddGoComments("go.rgst.io/stencil", "pkg/configuration"); err != nil {
if err := r.AddGoComments("go.rgst.io/stencil/v2", "pkg/configuration"); err != nil {
fmt.Printf("error adding comments for %s: %v\n", s.FileName, err)
os.Exit(1)
}
Expand Down

0 comments on commit ccc083c

Please sign in to comment.