Files
Gereh/.drone.yml
2026-08-13 20:00:11 +03:30

205 lines
6.1 KiB
YAML

---
kind: pipeline
name: "Push"
concurrency:
limit: 2
steps:
- name: "Test & Build"
image: node:12.13.1
commands:
- export REACT_APP_GIT_SHA=$(git rev-parse --short HEAD)
- echo $REACT_APP_GIT_SHA > .tags
- export BUILD_DOMAIN=$(test -e .domains && cat .domains)
- export BUILD_EXPIRE=$(date -d "+1 month" +%s000)
- npm -g install yarn
- yarn install
- yarn lint
- yarn test:ci --collectCoverage=true
- yarn build
# - name: "Stage with mock server"
# image: instrumentisto/rsync-ssh
# environment:
# PRIVATE_KEY:
# from_secret: deploy_key
# commands:
# - echo "$PRIVATE_KEY" | base64 -d > id_rsa
# - chmod 0600 id_rsa
# - cd build/config/
# - echo "window.env={api:{authUrl:'http://api-v2.mock.openware.work/api/v2/barong',tradeUrl:'http://api-v2.mock.openware.work/api/v2/peatio',applogicUrl:'http://api-v2.mock.openware.work/api/v2/applogic',rangerUrl:'ws://ranger.mock.openware.work/api/v2/ranger'}};" > env.js
# - cat env.js
# - cd /drone/src
# - rsync -avzhre "ssh -i id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" build/ mock@mock.openware.work:/home/mock/builds/${DRONE_COMMIT_SHA:0:7}
# - rsync -avzhre "ssh -i id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" coverage/ mock@mock.openware.work:/home/mock/builds/${DRONE_COMMIT_SHA:0:7}-coverage
# - echo "http://${DRONE_COMMIT_SHA:0:7}.mock.openware.work"
# - echo "http://${DRONE_COMMIT_SHA:0:7}-coverage.mock.openware.work"
# - name: "Notify staging"
# image: plugins/slack
# settings:
# webhook:
# from_secret: baseapp_slack_webhook
# channel:
# from_secret: baseapp_slack_channel
# template: >
# {{#success build.status}}
# [SUCCESS] (Base Application) Branch {{ build.branch }} by {{ build.author }} staging has succeeded!
#
# Visit http://{{ truncate build.commit 7 }}.mock.openware.work to check it out!
# Coverage report: http://{{ truncate build.commit 7 }}-coverage.mock.openware.work
# {{else}}
# [FAILURE] Branch {{ build.branch }} by {{ build.author }} staging has failed!
# {{/success}}
# Check the build info here: {{ build.link }}
# when:
# status: [success, failure]
trigger:
event:
- push
branch:
exclude:
- master
- "2-*-stable"
---
kind: pipeline
name: "New version"
concurrency:
limit: 2
steps:
- name: "Test"
image: node:12.13.1
commands:
- npm -g install yarn
- yarn install
- yarn lint
- yarn test:ci --collectCoverage=true
- name: "Bump & Tag"
image: quay.io/openware/sdk-citools:2.6.7
environment:
BRANCH_NAME: ${DRONE_BRANCH}
REPO_NAME: ${DRONE_REPO}
GITHUB_API_KEY:
from_secret: kite_bot_key
commands:
- BUNDLE_GEMFILE=/sdk/Gemfile bundle exec rake --rakefile=/sdk/Rakefile ci:prebuild
- name: "Build Docker image"
image: plugins/docker
settings:
username:
from_secret: quay_username
password:
from_secret: quay_password
repo:
from_secret: quay_repo
registry: quay.io
environment:
REACT_APP_SENTRY_KEY:
from_secret: master_sentry_key
REACT_APP_SENTRY_ORGANIZATION:
from_secret: master_sentry_organization
REACT_APP_SENTRY_PROJECT:
from_secret: master_sentry_project
- name: "Redeploy on master.devkube.com"
image: rubykube/microkube:0.2.0
environment:
WEBHOOK_JWT_SECRET:
from_secret: devkube_webhook_secret
DOCKER_REPO:
from_secret: quay_repo
commands:
- export latest_image=$DOCKER_REPO:$(cat .tags)
- cd /home/app
- bundle exec rake payload:send[frontend,$latest_image,http://$DRONE_BRANCH.devkube.com:1337]
when:
branch:
- master
- name: "Push and Notify"
image: quay.io/openware/sdk-citools:2.6.7
environment:
BOT_USERNAME: kite-bot
BOT_NAME: Kite Bot
BOT_EMAIL: kite-bot@heliostech.fr
BRANCH_NAME: ${DRONE_BRANCH}
SDK_BRANCH: ${DRONE_BRANCH}
REPO_NAME: ${DRONE_REPO}
TELEGRAM_BOT_TOKEN:
from_secret: baseapp_telegram_bot_token
TELEGRAM_CHAT_ID:
from_secret: baseapp_telegram_chat_id
SLACK_TOKEN:
from_secret: baseapp_slack_token
SLACK_CHANNEL:
from_secret: baseapp_slack_channel
GITHUB_API_KEY:
from_secret: kite_bot_key
commands:
- BUNDLE_GEMFILE=/sdk/Gemfile bundle exec rake --rakefile=/sdk/Rakefile ci:postbuild[/drone/src]
when:
branch:
- master
- "2-*-stable"
# http://plugins.drone.io/drone-plugins/drone-slack/
- name: Slack Notify
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
channel:
from_secret: slack_webhook_channel
template: >
*{{uppercasefirst repo.name}}*
{{#success build.status}}
[SUCCESS] Branch {{ build.branch }} by {{ build.author }}. Good job.
{{else}}
[FAILURE] Branch {{ build.branch }} by {{ build.author }}. Fix me please.
{{/success}}
when:
branch:
- master
- "2-*-stable"
- name: "Update global OpenDAX version"
image: quay.io/openware/goci:0.0.11
environment:
GIT_TOKEN:
from_secret: kite_bot_key
commands:
- /app/goci -component=frontend versions
when:
branch:
- "*-stable"
- name: "Build custom baseapp with assembly line"
image: curlimages/curl
environment:
SERVER: https://ci.openware.work
REPO: openware/assembly-line
BRANCH: master
COMPONENT: baseapp
DRONE_TOKEN:
from_secret: drone_token
commands:
- COMPONENT_VERSION=$(cat .tags)
- "curl -s -XPOST -H \"Authorization: Bearer $DRONE_TOKEN\" -i \"$SERVER/api/repos/$REPO/builds?branch=$BRANCH&ASSEMBLY_COMPONENT_VERSION=$COMPONENT_VERSION&ASSEMBLY_COMPONENT=$COMPONENT\""
trigger:
branch:
- master
- "2-*-stable"
event:
- push
image_pull_secrets:
- dockerconfigjson