41 lines
1.7 KiB
Go
41 lines
1.7 KiB
Go
package releasekit
|
|
|
|
import (
|
|
"context"
|
|
|
|
internalpreparation "gitea.maximumdirect.net/eric/ReleaseKit/internal/preparation"
|
|
)
|
|
|
|
// TaggedCheckoutRequest selects a stable tag and the full Git object ID
|
|
// expected by an external build or CI event. An empty Remote selects origin.
|
|
type TaggedCheckoutRequest struct {
|
|
RepositoryDir string
|
|
Version string
|
|
Remote string
|
|
ExpectedCommit string
|
|
}
|
|
|
|
// PrepareTaggedCheckout fetches Version from Remote, verifies that its peeled
|
|
// commit matches ExpectedCommit, and checks out that commit detached. This
|
|
// operation mutates the selected local repository; use it for disposable
|
|
// checkouts where tag-fetch and checkout conflicts can be resolved by the
|
|
// caller. It does not publish a tag or hosted content.
|
|
func PrepareTaggedCheckout(ctx context.Context, request TaggedCheckoutRequest) error {
|
|
return internalpreparation.PrepareTaggedCheckout(ctx, internalpreparation.TaggedCheckoutRequest{
|
|
RepositoryDir: request.RepositoryDir,
|
|
Version: request.Version,
|
|
Remote: request.Remote,
|
|
ExpectedCommit: request.ExpectedCommit,
|
|
})
|
|
}
|
|
|
|
// PrepareBuildDependencies runs `go mod download` in repositoryDir with
|
|
// workspace discovery disabled and the locally available compatible Go
|
|
// toolchain selected. It may access module networks and updates the Go module
|
|
// cache using the caller's Go proxy, private-module, credential, and cache
|
|
// settings. If required checksums are missing, the Go command may update
|
|
// go.sum. Cancellation and Go command failures are returned to the caller.
|
|
func PrepareBuildDependencies(ctx context.Context, repositoryDir string) error {
|
|
return internalpreparation.PrepareBuildDependencies(ctx, repositoryDir)
|
|
}
|