From 65c5c7880a8d9faef495dc8c018aa3970413ed51 Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Fri, 18 Apr 2025 21:00:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.drone.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 92 ++++++++++++++++++++++-------------------------------- 1 file changed, 37 insertions(+), 55 deletions(-) diff --git a/.drone.yml b/.drone.yml index b41d62e..130ba42 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,83 +1,69 @@ -# .drone.yml kind: pipeline name: default workspace: - base: /go - path: src/github.com/octocat/hello-world + base: /go + path: src/github.com/octocat/hello-world + +volumes: + - name: outdir + host: + path: /root/web steps: - name: test - image: golang + image: golang:1.21 + environment: + GOPROXY: https://mirrors.aliyun.com/goproxy/ commands: - - export GOPROXY=https://mirrors.aliyun.com/goproxy/ - - go test + - go mod tidy + - go test ./... - name: clone_web image: alpine/git commands: - - mkdir /go/web - - ls /go/web - - git clone https://git.shagain.club/lingling/go_echo_wol_web.git /go/web + - git clone https://git.shagain.club/lingling/go_echo_wol_web.git /go/web - name: build_web - image: node + image: node:18-alpine commands: - - cd /go/web/ - - npm install yarn - - yarn config set registry https://registry.npm.taobao.org --global - - yarn - - sed -i 's?(dev_ws_url)?(wsurl)?g' ./src/api/websocket.js - - yarn build + - cd /go/web/ + - yarn config set registry https://registry.npm.taobao.org --global + - yarn install + - sed -i 's?(dev_ws_url)?(wsurl)?g' ./src/api/websocket.js + - yarn build -- name: build - image: golang:bullseye +- name: build_go_app + image: golang:1.21-bullseye volumes: - - name: outdir - path: /root/web + - name: outdir + path: /root/web commands: - - rm -rf /root/web/* - - rm -rf ./app/* - - cp -r /go/web/build/* ./app/ - - sed -i 's?/static?/static/static?g' ./app/index.html - - sed -i 's?/favicon.ico?/static/favicon.ico?g' ./app/index.html - - sed -i 's?/logo192.png?/static/logo192.png?g' ./app/index.html - - sed -i 's?/manifest.json?/static/manifest.json?g' ./app/index.html - - apt update -y && apt install build-essential -y - - bash bulid.sh + - rm -rf /root/web/* + - rm -rf ./app/* + - cp -r /go/web/build/* ./app/ + - sed -i 's?/static?/static/static?g' ./app/index.html + - sed -i 's?/favicon.ico?/static/favicon.ico?g' ./app/index.html + - sed -i 's?/logo192.png?/static/logo192.png?g' ./app/index.html + - sed -i 's?/manifest.json?/static/manifest.json?g' ./app/index.html + - apt update && apt install -y build-essential + - bash bulid.sh -- name: 打包Docker镜像并推送 +- name: docker_build_push image: plugins/docker settings: repo: linglingking/go_wol_web use_cache: true - username: + auto_tag: true + username: from_secret: docker_name - password: + password: from_secret: docker_password - auto_tag: true # 自动打tag - # 也可以用下面这个手动指定 - # tags: - # - latest - # - 0.0.1 when: event: push branch: master -# - name: 钉钉通知 -# image: lddsb/drone-dingtalk-message -# settings: -# token: e53b19defd95a6f27ca766051b3ba047328760b0bbcd7c9fb6e74bc33635eb07 -# type: markdown -# secret: SECad13514bd7dee3fa73eeec19c32cfa2495a0f94976162f8534af956be30870e4 -# message_pic: true -# message_color: true -# debug: false -# when: -# status: [failure, success] - - -- name: 钉钉通知 +- name: dingtalk_notify image: guoxudongdocker/drone-dingtalk settings: token: e53b19defd95a6f27ca766051b3ba047328760b0bbcd7c9fb6e74bc33635eb07 @@ -87,7 +73,3 @@ steps: sha_link: true when: status: [ failure, success ] -volumes: - - name: outdir - host: - path: /root/web