Browse Source

Merge pull request 'feat: ci' (#8) from dev into test

Reviewed-on: #8
pull/9/head v1.0.0-beta.6
黄敏豪 2 years ago
parent
commit
6f11eea224
  1. 130
      .drone.yml

130
.drone.yml

@ -15,8 +15,6 @@ trigger:
- dev - dev
event: event:
- push - push
environment:
a: 1
volumes: volumes:
- name: dockersock - name: dockersock
host: host:
@ -24,9 +22,6 @@ volumes:
- name: node - name: node
host: host:
path: /data/drone/node_modules-project-iot-qmgo path: /data/drone/node_modules-project-iot-qmgo
- name: localtime
host:
path: /etc/localtime
steps: steps:
# 从dev合并到test 从dev合并到master # 从dev合并到test 从dev合并到master
- name: 生成Release版本 - name: 生成Release版本
@ -34,40 +29,38 @@ steps:
# image: exment/drone-semantic-release:latest # image: exment/drone-semantic-release:latest
image: registry.cn-hangzhou.aliyuncs.com/tgabc-namespace/tgabc:semantic-release-v21.0.1 image: registry.cn-hangzhou.aliyuncs.com/tgabc-namespace/tgabc:semantic-release-v21.0.1
environment: environment:
# GOOS: linux
GITEA_TOKEN: GITEA_TOKEN:
from_secret: gitea_token
# command: [ "--tagFormat", "test_${version}" ]
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: settings:
git_login: git_login:
from_secret: gitea_username from_secret: gitea_username
git_password: git_password:
from_secret: gitea_password from_secret: gitea_password
# - name: test分支获取master信息
# image: alpine/git:v2.36.2
# commands:
# - git fetch origin test
# - git checkout test
# - git merge origin/master
# - git commit --amend -m "[skip ci]从master合并历史到test"
# - git branch --set-upstream-to=origin/test test
# - git pull
# - git push --set-upstream origin test
# - git checkout master
# when:
# branch:
# - master
- name: 获取tag数据 - name: 获取tag数据
image: alpine/git:v2.36.2 image: alpine/git:v2.36.2
environment: environment:
GITEA_TOKEN:
from_secret: "gitea_token"
USER: USER:
from_secret: gitea_username
from_secret: "gitea_username"
PASSWD: PASSWD:
from_secret: gitea_password
from_secret: "gitea_password"
obs_key:
from_secret: "obs_key"
obs_secret:
from_secret: "obs_secret"
commands: commands:
- git config --global credential.helper store - git config --global credential.helper store
- echo "https://$USER:$PASSWD@git.1000my.com" >> ~/.git-credentials - echo "https://$USER:$PASSWD@git.1000my.com" >> ~/.git-credentials
- cat ~/.git-credentials
- env
- git fetch --tags - git fetch --tags
- git submodule init - git submodule init
- git submodule update --recursive --remote - git submodule update --recursive --remote
@ -85,6 +78,18 @@ steps:
- name: 代码构建 - name: 代码构建
pull: if-not-exists pull: if-not-exists
image: registry.k8s.1000my.com/library/node:16.15.0-slim image: registry.k8s.1000my.com/library/node:16.15.0-slim
# image: registry.cn-hangzhou.aliyuncs.com/qmiot/init:node-14-slim-python2_3
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: volumes:
- name: node - name: node
path: /drone/src/node_modules path: /drone/src/node_modules
@ -108,15 +113,22 @@ steps:
pull: if-not-exists pull: if-not-exists
image: registry.cn-hangzhou.aliyuncs.com/qmiot/init:mysqlinit-base-python image: registry.cn-hangzhou.aliyuncs.com/qmiot/init:mysqlinit-base-python
environment: environment:
GITEA_TOKEN:
from_secret: "gitea_token"
USER:
from_secret: "gitea_username"
PASSWD:
from_secret: "gitea_password"
obs_key: obs_key:
from_secret: obs_key
from_secret: "obs_key"
obs_secret: obs_secret:
from_secret: obs_secret
from_secret: "obs_secret"
cdn_url: https://qianmu-iot.1000my.com/
commands: commands:
# - sed -i "s@https://.*"@https://iot-${DRONE_BRANCH}.123.1000my.com"@" build/public/config.json # - sed -i "s@https://.*"@https://iot-${DRONE_BRANCH}.123.1000my.com"@" build/public/config.json
- obsutil config -i=$obs_key -k=$obs_secret -e=obs.cn-east-2.myhuaweicloud.com - obsutil config -i=$obs_key -k=$obs_secret -e=obs.cn-east-2.myhuaweicloud.com
- obsutil mkdir obs://qianmu-iot/base_qmgo_react-${DRONE_BRANCH}/
- obsutil cp -r -f -flat build obs://qianmu-iot/base_qmgo_react-${DRONE_BRANCH}/
- obsutil mkdir obs://qianmu-iot/${DRONE_REPO_NAME}-${DRONE_BRANCH}/
- obsutil cp -r -f -flat build obs://qianmu-iot/${DRONE_REPO_NAME}-${DRONE_BRANCH}/
when: when:
branch: branch:
- dev - dev
@ -125,15 +137,65 @@ steps:
pull: if-not-exists pull: if-not-exists
image: registry.cn-hangzhou.aliyuncs.com/qmiot/init:mysqlinit-base-python image: registry.cn-hangzhou.aliyuncs.com/qmiot/init:mysqlinit-base-python
environment: environment:
GITEA_TOKEN:
from_secret: "gitea_token"
USER:
from_secret: "gitea_username"
PASSWD:
from_secret: "gitea_password"
obs_key: obs_key:
from_secret: obs_key
from_secret: "obs_key"
obs_secret: obs_secret:
from_secret: obs_secret
from_secret: "obs_secret"
cdn_url: https://qianmu-iot.1000my.com/
commands: commands:
# - sed -i "s@https://.*"@https://iot.1000my.com"@" build/public/config.json # - sed -i "s@https://.*"@https://iot.1000my.com"@" build/public/config.json
- obsutil config -i=$obs_key -k=$obs_secret -e=obs.cn-east-2.myhuaweicloud.com - obsutil config -i=$obs_key -k=$obs_secret -e=obs.cn-east-2.myhuaweicloud.com
- obsutil mkdir obs://qianmu-iot/base_qmgo_react/
- obsutil cp -r -f -flat build obs://qianmu-iot/base_qmgo_react/
- obsutil mkdir obs://qianmu-iot/${DRONE_REPO_NAME}/
- obsutil cp -r -f -flat build obs://qianmu-iot/${DRONE_REPO_NAME}/
when:
branch:
- master
- name: cdn缓存刷新dev test
pull: if-not-exists
image: registry.cn-hangzhou.aliyuncs.com/qmiot/init:qmugo_cdn_flush
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"
cdn_url: https://qianmu-iot.1000my.com/
commands:
- export cdn_url=https://qianmu-iot.1000my.com/${DRONE_REPO_NAME}-${DRONE_BRANCH}/
- /cdn.bin
when:
branch:
- dev
- test
- name: cdn缓存刷新 master
pull: if-not-exists
image: registry.cn-hangzhou.aliyuncs.com/qmiot/init:qmugo_cdn_flush
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"
cdn_url: https://qianmu-iot.1000my.com/
commands:
- export cdn_url=https://qianmu-iot.1000my.com/${DRONE_REPO_NAME}/
- /cdn.bin
when: when:
branch: branch:
- master - master
@ -157,4 +219,4 @@ steps:
failure_pic: "https://raw.githubusercontent.com/Ethan-Liuu/picture/master/failed.png" failure_pic: "https://raw.githubusercontent.com/Ethan-Liuu/picture/master/failed.png"
tpl: "http://get.k8s.1000my.com/.shell/.tpl" tpl: "http://get.k8s.1000my.com/.shell/.tpl"
when: when:
status: [failure, success]
status: [failure, success]
Loading…
Cancel
Save