Browse Source

测试 drone

liql 2 years ago
parent
commit
eef51a4311
1 changed files with 15 additions and 13 deletions
  1. 15 13
      drone.yml

+ 15 - 13
drone.yml

@@ -3,6 +3,17 @@ type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
 name: veterans_demo # 定义流水线名称
 
 steps: # 定义流水线执行步骤,这些步骤将顺序执行
+  - name: package # 流水线名称
+    image: alpine:latest # 定义创建容器的Docker镜像
+    volumes: #将容器内目录挂载到宿主机,仓库需要开启Trusted设置
+      - name: node-build
+        path: /tmp
+    commands: # 定义在Docker容器中执行的shell命令
+      - pwd
+      - ls
+      - mkdir -p /tmp/veterans_demo
+      - cp -r /drone/src/images index.html js styles /tmp/veterans_demo
+
   - name: deploy
     image: appleboy/drone-ssh # SSH工具镜像
     settings:
@@ -12,19 +23,10 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
         from_secret: 64_ssh_pw # 从Secret中读取SSH密码
       port: 22 # 远程连接端口
       command_timeout: 5m # 远程执行命令超时时间
-      volumes: #将容器内目录挂载到宿主机,仓库需要开启Trusted设置
-        - name: node-build
-          path: /tmp
-      commands: # 定义在Docker容器中执行的shell命令
-        - pwd
-        - ls
-        - mkdir -p /tmp/veterans_demo
-        - cp -r /drone/src/* /tmp/veterans_demo/
-        - echo '=================================================================================================='
-      #script:
-      #  - mv /www/wwwroot/veterentry.hw.hongweisoft.com/ /tmp/$(uuidgen)
-      #  - mkdir -p /www/wwwroot/veterentry.hw.hongweisoft.com
-      #  - cp -r /mydata/node/build/veterans_demo/* /www/wwwroot/veterentry.hw.hongweisoft.com # 进入宿主机构建目录
+      script:
+        - mv /www/wwwroot/veterentry.hw.hongweisoft.com/ /tmp/$(uuidgen)
+        - mkdir -p /www/wwwroot/veterentry.hw.hongweisoft.com
+        - cp -r /mydata/node/build/veterans_demo/* /www/wwwroot/veterentry.hw.hongweisoft.com # 进入宿主机构建目录
 
 volumes:
   - name: node-build