simulate file 2
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 50s

This commit is contained in:
Alexandre Bruyant 2024-01-07 18:44:08 +01:00
parent 925ccc3b9e
commit e265a66948

22
main.go
View File

@ -14,10 +14,9 @@ import (
)
type AddResponse struct {
Bytes int64
Hash string
Name string
Size string
Hash string
Name string
Size string
}
type IpfsMultipartWriter struct {
@ -117,15 +116,24 @@ func main() {
githubactions.Fatalf("Unable to create root dir path: %v", fmt.Errorf("%w", err))
}
w, err := mwriter.CreateIpfsFilePart("blog/test.html")
w, err := mwriter.CreateIpfsFilePart("blog/index.html")
if err != nil {
githubactions.Fatalf("Unable to create index file part: %v", fmt.Errorf("%w", err))
}
fileReader, _ := os.Open("blog/test.html")
fileReader, _ := os.Open("blog/index.html")
defer fileReader.Close()
io.Copy(w, fileReader)
w, err = mwriter.CreateIpfsFilePart("blog/posts/hosting-static-site-on-ipfs/index.html")
if err != nil {
githubactions.Fatalf("Unable to create index file part: %v", fmt.Errorf("%w", err))
}
fileReader2, _ := os.Open("blog/posts/hosting-static-site-on-ipfs/index.html")
defer fileReader2.Close()
io.Copy(w, fileReader2)
// err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error {
// if err != nil {
// return err
@ -177,7 +185,7 @@ func main() {
var ipfsAddResponse AddResponse
json.Unmarshal(resBody, &ipfsAddResponse)
githubactions.Infof("Upload size is %v", ipfsAddResponse.Bytes)
githubactions.Infof("Upload size is %v", ipfsAddResponse.Size)
githubactions.Infof("CID is %v", ipfsAddResponse.Hash)
githubactions.SetOutput("cid", ipfsAddResponse.Hash)
}