forked from fangbinwei/aliyun-oss-website-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
37 lines (28 loc) · 767 Bytes
/
main.go
File metadata and controls
37 lines (28 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"fmt"
"os"
"aliyun-oss-website-action/config"
"aliyun-oss-website-action/operation"
"aliyun-oss-website-action/utils"
)
func main() {
defer utils.TimeCost()()
if !config.SkipSetting {
operation.SetStaticWebsiteConfig()
} else {
fmt.Println("skip setting static pages related configuration")
}
fmt.Println("---- delete start ----")
deleteErrs := operation.DeleteObjects(config.Bucket)
utils.LogErrors(deleteErrs)
fmt.Println("---- delete end ----")
records := utils.WalkDir(config.Folder)
fmt.Println("---- upload start ----")
_, uploadErrs := operation.UploadObjects(config.Folder, config.Bucket, records)
utils.LogErrors(uploadErrs)
fmt.Println("---- upload end ----")
if len(uploadErrs) > 0 {
os.Exit(1)
}
}