123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- package main
- import (
- "app-uploader/utils"
- "fmt"
- "runtime"
- )
- func main() {
- // 读取package.json版本数据
- // 复制app.json文件和logo文件
- // 读取配置
- appConf, err := utils.ReadAppConfig()
- if err != nil {
- fmt.Println("读取配置文件错误")
- return
- }
- fmt.Println(appConf)
- uploadConf, err := utils.ReadConfig()
- if err != nil {
- fmt.Println("读取配置文件错误")
- return
- }
- dest := ""
- copyFiles := []string{}
- // 需要修改版本的文件
- modify := ""
- // 复制文件到对应目录
- switch appConf.Key {
- case "queenter":
- dest = uploadConf.Queenter.Dest
- copyFiles = uploadConf.Queenter.Files
- modify = uploadConf.Queenter.Modify
- default:
- return
- }
- // 复制文件到目标目录中
- for _, file := range copyFiles {
- err := utils.Copy(file, fmt.Sprintf("%s/%s", dest, file))
- if err != nil {
- fmt.Println(err)
- return
- }
- }
- // 获取版本信息
- version, err := utils.GetVersion()
- if err != nil {
- fmt.Println(err)
- return
- }
- appConf.Version = version
- appConfDest := fmt.Sprintf("%s/%s", dest, modify)
- err = utils.WriteAppConfig(appConf, appConfDest)
- if err != nil {
- fmt.Println(err)
- return
- }
- // 压缩文件
- // remoteswift-v1.0.0-x64-windows.zip
- zipPath := fmt.Sprintf("output/%s-v%s-%s-%s.zip", appConf.Key, version, runtime.GOARCH, runtime.GOOS)
- fmt.Println("压缩文件中...")
- utils.Zip(zipPath, dest)
- if err != nil {
- fmt.Println("压缩文件出错")
- return
- }
- // 上传文件
- // 输出db文件
- }
|