1
0
lifei6671 8 жил өмнө
parent
commit
41e19269e2
2 өөрчлөгдсөн 15 нэмэгдсэн , 1 устгасан
  1. 8 1
      appveyor.yml
  2. 7 0
      commands/install.go

+ 8 - 1
appveyor.yml

@@ -10,10 +10,12 @@ environment:
     - tbs_arch: "x86"
       tbs_tools: "mingw"
       tbs_static_runtime: 1
+      GOARCH: 386
 
     - tbs_arch: "x64"
       tbs_tools: "mingw"
       tbs_static_runtime: 1
+      GOARCH: amd64
 
 build: false
 deploy: true
@@ -39,8 +41,13 @@ install:
   - go env
   - go get -d ./...
 
+build_script:
+  - if [%tbs_tools%]==[mingw] if [%tbs_arch%]==[x86] SET PATH=C:\mingw32\bin;%PATH%
+  - if [%tbs_tools%]==[mingw] if [%tbs_arch%]==[x64] SET PATH=C:\mingw64\bin;%PATH%
+  - go build -v -o "godoc_windows_%GOARCH%.exe" -ldflags="-w -X github.com/lifei6671/godoc/conf.VERSION=%APPVEYOR_REPO_TAG_NAME% -X 'github.com/lifei6671/godoc/conf.BUILD_TIME=`date`' -X 'conf.GO_VERSION=`github.com/lifei6671/godoc/go version`'"
+
 test_script:
-  - go build -x -v -tags "pam" -ldflags "-w"
+  - godoc_windows_%GOARCH%.exe version
 
 notifications:
   - provider: Email

+ 7 - 0
commands/install.go

@@ -28,6 +28,13 @@ func Install() {
 	}
 }
 
+func Version()  {
+	if len(os.Args) >= 2 && os.Args[1] == "version" {
+		fmt.Println(conf.VERSION)
+		os.Exit(0)
+	}
+}
+
 //初始化数据
 func initialization() {