Browse Source

添加自动发布配置文件

lcl 11 months ago
parent
commit
7daa05b523
3 changed files with 91 additions and 8 deletions
  1. 82 0
      .drone.yml
  2. 1 0
      .gitignore
  3. 8 8
      appsettings.Development.json

+ 82 - 0
.drone.yml

@@ -0,0 +1,82 @@
+kind: pipeline
+type: docker
+name: kxs-activityserver-test
+
+volumes: # 声明数据卷
+  - name: targetDir
+    host:
+      path: /kxs_activityserver_com
+
+clone:
+  disable: false # 启用代码拉取
+
+steps:
+  - name: build-project
+    image: mcr.microsoft.com/dotnet/core/sdk:3.0-alpine
+    pull: if-not-exists
+    depends_on: [clone] # 依赖的步骤
+    volumes: # 挂载数据卷
+      - name: targetDir
+        path: /drone/src/dist/
+    commands: # 执行命令
+      - dotnet publish -c release -o ./publish
+      - ls ./publish
+      - cp -r ./publish/* /drone/src/dist # 复制文件
+      - ls /drone/src/dist
+    when:
+      status:
+        - success # 当前步骤成功时执行
+  - name: scp-project
+    image: appleboy/drone-scp
+    pull: if-not-exists
+    depends_on: [build-project] # 依赖的步骤
+    volumes: # 挂载数据卷
+      - name: targetDir # 数据卷名称
+        path: /kxs_activityserver_com # 容器内目录 绝对路径
+    settings:
+      host:
+        from_secret: host
+      username:
+        from_secret: username
+      password:
+        from_secret: userpwd
+      port: 22
+      command_timeout: 2m
+      target: /home/ABServer/deploy-ready/
+      source:
+        - echo ====开始拷贝=======
+        - /kxs_activityserver_com/*
+        - echo ====结束拷贝=======
+      when:
+        status:
+          - success # 当前步骤成功时执行
+
+  - name: deploy-project
+    image: appleboy/drone-ssh
+    pull: if-not-exists
+    depends_on: [scp-project] # 依赖的步骤
+    settings:
+      host:
+        from_secret: host
+      username:
+        from_secret: username
+      password:
+        from_secret: userpwd
+      port: 22
+      command_timeout: 2m
+      script:
+        - echo ====开始部署=======
+        - cd /home/ABServer/
+        - cp -r /home/ABServer/deploy-ready/kxs_activityserver_com /home/ABServer/webroot/
+        # - docker stop kxs_activityserver_com && docker rm kxs_activityserver_com && docker-compose up -d kxs_activityserver_com
+        - docker restart kxs_activityserver_com
+        - echo ====部署成功=======
+
+trigger:
+  branch:
+    include:
+      - test-activityserver
+  event:
+    include:
+      - pull_request
+      - push

+ 1 - 0
.gitignore

@@ -1,4 +1,5 @@
 /bin
 /publish
 /obj
+/appsettings.json
 *.DS_Store

+ 8 - 8
appsettings.Development.json

@@ -17,16 +17,16 @@
     "Host": "http://localhost:5047/",
     "SourceHost": "http://bs.kexiaoshuang.com/",
     "Database": "KxsMainServer",
-    "SqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=FrW8ZfxlcaVdm1r0;database=KxsMainServer;charset=utf8;ConnectionTimeout=600;DefaultCommandTimeout=600;",
-    "Pxc1SqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=FrW8ZfxlcaVdm1r0;database=KxsMainServer;charset=utf8;ConnectionTimeout=600;DefaultCommandTimeout=600;",
-    "ReadSqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=FrW8ZfxlcaVdm1r0;database=KxsMainServer;charset=utf8;",
-    "MainSqlConnStr": "server=47.109.31.237;port=3306;user=KxsMainServer;password=FrW8ZfxlcaVdm1r0;database=KxsStatServer;charset=utf8;",
-    "SpSqlConnStr": "server=47.109.31.237;port=3306;user=KxsSpServer;password=jJ9qKsvwWgQA9xWG;database=KxsSpServer;charset=utf8;",
-    "OpSqlConnStr": "server=47.109.31.237;port=3306;user=KxsOpServer;password=r7jwZ8ydLoeswDR4;database=KxsOpServer;charset=utf8;",
+    "SqlConnStr": "server=47.108.62.166;port=3306;user=root;password=HDlNs1ZpG5iR9D9I;database=KxsMainServer;charset=utf8;ConnectionTimeout=600;DefaultCommandTimeout=600;",
+    "Pxc1SqlConnStr": "server=47.108.62.166;port=3306;user=root;password=HDlNs1ZpG5iR9D9I;database=KxsMainServer;charset=utf8;ConnectionTimeout=600;DefaultCommandTimeout=600;",
+    "ReadSqlConnStr": "server=47.108.62.166;port=3306;user=root;password=HDlNs1ZpG5iR9D9I;database=KxsMainServer;charset=utf8;",
+    "MainSqlConnStr": "server=47.108.62.166;port=3306;user=root;password=HDlNs1ZpG5iR9D9I;database=KxsStatServer;charset=utf8;",
+    "SpSqlConnStr": "server=47.108.62.166;port=3306;user=root;password=HDlNs1ZpG5iR9D9I;database=KxsSpServer;charset=utf8;",
+    "OpSqlConnStr": "server=47.108.62.166;port=3306;user=root;password=HDlNs1ZpG5iR9D9I;database=KxsOpServer;charset=utf8;",
     "MpSqlConnStr": "server=47.109.31.237;port=3306;user=QrCodePlateMainServer;password=ll4DFaALMu9YIooM;database=QrCodePlateMainServer;charset=utf8;",
     "MpSqlConnStr2": "server=47.109.31.237;port=3306;user=QrCodePlateMainServer;password=ll4DFaALMu9YIooM;database=QrCodePlateMainServer2;charset=utf8;",
-    "RdsStatSqlConnStr": "server=47.109.31.237;port=3306;user=KxsStatServer;password=mzeqjriUWore0dwT;database=KxsStatServer;charset=utf8;",
-    "RedisConnStr": "47.109.31.237:6379,password=klm@redis,DefaultDatabase=1,poolsize=500,preheat=50,asyncPipeline=true",
+    "RdsStatSqlConnStr": "server=47.108.62.166;port=3306;user=root;password=HDlNs1ZpG5iR9D9I;database=KxsStatServer;charset=utf8;",
+    "RedisConnStr": "47.108.62.166:6379,password=klm@redis,DefaultDatabase=1,poolsize=500,preheat=50,asyncPipeline=true",
     "IOSAppVersion": "1.0.0",
     "AndroidAppVersion": "1.0.0",
     "OSSKey": "iL9dWgBunZRwGbHQ",