Expose publication recovery facade
This commit is contained in:
28
publish.go
28
publish.go
@@ -40,16 +40,19 @@ const (
|
||||
|
||||
// PublicationResult describes the publication state reached by this call.
|
||||
type PublicationResult struct {
|
||||
RepositoryDir string // absolute source repository path.
|
||||
ModuleDir string // absolute selected module directory.
|
||||
ModulePath string // selected module's declared Go path.
|
||||
Tag string // complete selected Git tag.
|
||||
Version string // selected stable version
|
||||
CandidateCommit string // captured main commit
|
||||
Endpoint string // captured effective push URL, which may contain credentials
|
||||
Phase PublicationPhase // last operation phase reached
|
||||
TagObject string // local annotated tag object ID, when established; a local ref may remain even when empty
|
||||
State PublicationState // publication outcome for this invocation
|
||||
RepositoryDir string // absolute source repository path.
|
||||
ModuleDir string // absolute selected module directory.
|
||||
ModulePath string // selected module's declared Go path.
|
||||
Tag string // complete selected Git tag.
|
||||
Version string // selected stable version
|
||||
CandidateCommit string // captured main commit
|
||||
Endpoint string // captured effective push URL, which may contain credentials
|
||||
Phase PublicationPhase // last operation phase reached
|
||||
TagObject string // local annotated tag object ID, when established; a local ref may remain even when empty
|
||||
State PublicationState // publication outcome for this invocation
|
||||
Evidence PublicationEvidence // typed evidence for later reconciliation; Endpoint may contain credentials
|
||||
RecordPath string // absolute private record path when recording is available
|
||||
RecordError error // recording failure, separate from publication outcome
|
||||
}
|
||||
|
||||
// After publication preflight succeeds, Publish runs one offline Go test suite
|
||||
@@ -77,6 +80,10 @@ type PublicationResult struct {
|
||||
// or exact remote object match.
|
||||
func Publish(ctx context.Context, request ReleaseRequest) (PublicationResult, error) {
|
||||
candidateInput := candidateRequest(request)
|
||||
remote := request.Remote
|
||||
if remote == "" {
|
||||
remote = "origin"
|
||||
}
|
||||
result, err := publish.Publish(ctx, publish.Request{
|
||||
RepositoryDir: candidateInput.RepositoryDir,
|
||||
ModuleDir: candidateInput.ModuleDir,
|
||||
@@ -100,5 +107,6 @@ func Publish(ctx context.Context, request ReleaseRequest) (PublicationResult, er
|
||||
Phase: PublicationPhase(result.Phase),
|
||||
TagObject: result.TagObject,
|
||||
State: PublicationState(result.State),
|
||||
Evidence: PublicationEvidence{RepositoryDir: result.RepositoryDir, ModuleDir: result.ModuleDir, ModulePath: result.ModulePath, Tag: result.Tag, Version: result.Version, CandidateCommit: result.CandidateCommit, TagObject: result.TagObject, Endpoint: result.Endpoint, Remote: remote},
|
||||
}, convertValidationError(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user