mirror of
https://github.com/hanzoai/commerce.git
synced 2026-10-30 15:08:42 +00:00
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans, usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0. Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
32 lines
794 B
Go
32 lines
794 B
Go
package netlify
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"net/url"
|
|
|
|
"github.com/netlify/netlify-go"
|
|
|
|
"github.com/hanzoai/commerce/log"
|
|
)
|
|
|
|
func (c *Client) CreateDeploy(ste *Site, digest *Digest, draft bool) (*Deploy, error) {
|
|
log.Debug("Creating deploy for site: %s, using digest: %#v", ste.Id, digest, c.ctx)
|
|
|
|
// Manually construct call to netlify for deploy
|
|
params := url.Values{}
|
|
if draft {
|
|
params["draft"] = []string{"true"}
|
|
}
|
|
options := &netlify.RequestOptions{JsonBody: digest, QueryParams: ¶ms}
|
|
ndeploy := &netlify.Deploy{}
|
|
res, err := c.client.Request("POST", "/sites/"+ste.Id+"/deploys", options, ndeploy)
|
|
|
|
if err != nil {
|
|
buf, _ := ioutil.ReadAll(res.Body)
|
|
log.Error("Deploy failed, response: %s", string(buf), c.ctx)
|
|
return &Deploy{}, err
|
|
}
|
|
|
|
return newDeploy(ndeploy), err
|
|
}
|