Test
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 58s
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 58s
This commit is contained in:
parent
6b4eec8251
commit
925ccc3b9e
71
main.go
71
main.go
@ -4,12 +4,10 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/textproto"
|
"net/textproto"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/sethvargo/go-githubactions"
|
"github.com/sethvargo/go-githubactions"
|
||||||
@ -114,42 +112,51 @@ func main() {
|
|||||||
defer mwriter.Close()
|
defer mwriter.Close()
|
||||||
defer writer.Close()
|
defer writer.Close()
|
||||||
|
|
||||||
w, err := mwriter.CreateIpfsDirectoryPart(path)
|
_, err := mwriter.CreateIpfsDirectoryPart(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
githubactions.Fatalf("Unable to create root dir path: %v", fmt.Errorf("%w", err))
|
githubactions.Fatalf("Unable to create root dir path: %v", fmt.Errorf("%w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error {
|
w, err := mwriter.CreateIpfsFilePart("blog/test.html")
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if info.IsDir() {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
w, err = mwriter.CreateIpfsFilePart(innerPath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
fileReader, err := os.Open(innerPath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer fileReader.Close()
|
|
||||||
|
|
||||||
written, err := io.Copy(w, fileReader)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error copying %s (%d bytes written): %v", innerPath, written, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
githubactions.Fatalf("Unable to create request body: %v", fmt.Errorf("%w", err))
|
githubactions.Fatalf("Unable to create index file part: %v", fmt.Errorf("%w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fileReader, _ := os.Open("blog/test.html")
|
||||||
|
defer fileReader.Close()
|
||||||
|
io.Copy(w, fileReader)
|
||||||
|
|
||||||
|
// err = filepath.Walk(path, func(innerPath string, info fs.FileInfo, err error) error {
|
||||||
|
// if err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if info.IsDir() {
|
||||||
|
// return nil
|
||||||
|
// }
|
||||||
|
|
||||||
|
// w, err = mwriter.CreateIpfsFilePart(innerPath)
|
||||||
|
// if err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
|
||||||
|
// fileReader, err := os.Open(innerPath)
|
||||||
|
// if err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
// defer fileReader.Close()
|
||||||
|
|
||||||
|
// written, err := io.Copy(w, fileReader)
|
||||||
|
// if err != nil {
|
||||||
|
// return fmt.Errorf("error copying %s (%d bytes written): %v", innerPath, written, err)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return nil
|
||||||
|
// })
|
||||||
|
|
||||||
|
// if err != nil {
|
||||||
|
// githubactions.Fatalf("Unable to create request body: %v", fmt.Errorf("%w", err))
|
||||||
|
// }
|
||||||
}()
|
}()
|
||||||
|
|
||||||
githubactions.Infof("Calling node API")
|
githubactions.Infof("Calling node API")
|
||||||
|
Loading…
Reference in New Issue
Block a user