永旺顾客心声大屏展示端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

193 lines
5.9 KiB

kind: pipeline
type: docker
name: 程序部署
host_aliases:
- ip: 192.168.0.2
hostnames:
- git.1000my.com
clone:
pull: if-not-exists
depth: 1
trigger:
branch:
- test
- master
event:
- push
volumes:
- name: dockersock
host:
path: /data/drone/docker/sock
- name: node
host:
path: /data/drone/node_modules-navigation
- name: localtime
host:
path: /etc/localtime
steps:
- name: 生成Release版本
pull: if-not-exists
image: registry.cn-hangzhou.aliyuncs.com/tgabc-namespace/tgabc:semantic-release-v21.0.1
environment:
GITEA_TOKEN:
from_secret: "gitea_token"
USER:
from_secret: "gitea_username"
PASSWD:
from_secret: "gitea_password"
obs_key:
from_secret: "obs_key"
obs_secret:
from_secret: "obs_secret"
settings:
git_login:
from_secret: gitea_username
git_password:
from_secret: gitea_password
- name: 获取tag数据
image: alpine/git:v2.36.2
environment:
GITEA_TOKEN:
from_secret: "gitea_token"
USER:
from_secret: "gitea_username"
PASSWD:
from_secret: "gitea_password"
obs_key:
from_secret: "obs_key"
obs_secret:
from_secret: "obs_secret"
commands:
- git config --global credential.helper store
- echo "https://$USER:$PASSWD@git.1000my.com" >> ~/.git-credentials
- env
- git fetch --tags
- git submodule init
- git submodule update --recursive --remote
# 获取当前分支的tag
- git describe --abbrev=0 --tags > .tags
- cat .tags
# - git fetch --tags
# - git describe --tags `git rev-list --tags --max-count=1` > .tags
# - cat .tags
- name: 代码构建
pull: if-not-exists
# image: registry.k8s.1000my.com/library/node:16.15.0-slim
image: node:20-buster
environment:
GITEA_TOKEN:
from_secret: "gitea_token"
USER:
from_secret: "gitea_username"
PASSWD:
from_secret: "gitea_password"
obs_key:
from_secret: "obs_key"
obs_secret:
from_secret: "obs_secret"
volumes:
- name: node
path: /drone/src/node_modules
settings:
mirror: https://docker.mirrors.ustc.edu.cn
commands:
# npm打包
- npm config set registry https://registry.npmmirror.com/
- npm install
- npm run build
- chown -R 1000:1000 ./
when:
branch:
- test
- master
- name: zip构建
pull: if-not-exists
image: registry.cn-hangzhou.aliyuncs.com/qmiot/init:tizen
settings:
mirror: https://docker.mirrors.ustc.edu.cn
commands:
# zip打包
- mv dist target
- zip_name=$DRONE_REPO_NAME.$(cat .tags).zip
- cd ./target
- rm -rf static/offline
- zip -q -r $zip_name ./
- ls $zip_name
- ls
- pwd
when:
branch:
- test
- master
- name: 上传zip到iot测试接口platformProgramAdd
pull: if-not-exists
image: registry.cn-hangzhou.aliyuncs.com/qmiot/init:apisix-init-base
environment:
url_for_iotplatform: 'http://192.168.0.142:31667'
url_for_iotfile: 'http://192.168.0.142:31666'
logo: '/drone/src/logo.jpg'
cdn_url: 'https://test-598d.1000my.com'
# genre: "Samsung"
commands:
# # 自动授权
# - export projectCode="projectCode=project-inluar4ppcxvciefgb_ila"
- export name="导视_测试版" # 应用名称(自行填写 必填)
- export version=$(cat .tags) # 应用版本
- export sourceId="8" # 应用来源id(默认为8 即测试环境专用) //如需更改查看测试环境平台级下应用管理新增应用的/api/platform/v1/platformProgram/platformProgramAdd接口
- export genre="localpack" # 应用类型 本地资源包 [outchain, localpack]
- export resolution="2160*3840竖屏" # 分辨率(自行填写)[1080*1920竖屏, 1920*1080横屏, 3840*2160横屏, 2160*3840竖屏]
- export package="/drone/src/target/$DRONE_REPO_NAME.$(cat .tags).zip" # zip包名称
- export des=$CI_COMMIT_MESSAGE # 应用描述
- python3 iot_upload.py
when:
branch:
- test
- name: 上传zip到iot正式接口platformProgramAdd
pull: if-not-exists
image: registry.cn-hangzhou.aliyuncs.com/qmiot/init:apisix-init-base
environment:
url_for_iotplatform: 'http://192.168.0.11:31667'
url_for_iotfile: 'http://192.168.0.11:31666'
logo: '/drone/src/logo.jpg'
cdn_url: 'https://qianmu-iot.1000my.com'
# genre: "Samsung"
commands:
- export name="导视_正式版" # 应用名称(自行填写)
- export version=$(cat .tags) # 应用版本
- export sourceId="3" # 应用来源id
- export genre="localpack" # 应用类型 本地资源包
- export resolution="1920*1080横屏" # 分辨率(自行填写)[1080*1920竖屏, 1920*1080横屏, 3840*2160横屏, 2160*3840竖屏]
- export package="/drone/src/target/$DRONE_REPO_NAME.$(cat .tags).zip" # zip包名称
- export des=$CI_COMMIT_MESSAGE # 应用描述
- python3 iot_upload.py
when:
branch:
- master
- name: dingTalk notification
pull: if-not-exists
image: lddsb/drone-dingtalk-message
failure: ignore
settings:
token: 55049b40bd6eb17aea64e113af2d55d581159292eb85a071afa76c7e0562020d #具体项目钉钉群机器人token
type: markdown
message_color: true
message_pic: true
sha_link: true
tips_title: "${CI_REPO_NAME}"
debug: true
success_color: "008000"
failure_color: "FF0000"
tpl_repo_short_name: "${CI_REPO_NAME}"
msg_at_mobiles: "@${CI_COMMIT_AUTHOR_NAME}"
success_pic: "https://raw.githubusercontent.com/Ethan-Liuu/picture/master/success.png"
failure_pic: "https://raw.githubusercontent.com/Ethan-Liuu/picture/master/failed.png"
tpl: '/drone/src/.tpl'
when:
status: [failure, success]