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.
56 lines
1.3 KiB
56 lines
1.3 KiB
kind: pipeline
|
|
name: default
|
|
|
|
steps:
|
|
- name: build
|
|
image: node
|
|
commands:
|
|
- npm install
|
|
- npm run build
|
|
|
|
- name: deploy
|
|
image: alpine
|
|
environment:
|
|
HOST: blog.example.ru
|
|
USER: droneci
|
|
WEB_DIR: /var/www/blog.example.ru/
|
|
SSH_KEY:
|
|
from_secret: ssh_key
|
|
commands:
|
|
- apk add --no-cache rsync openssh
|
|
- mkdir ~/.ssh/
|
|
- chmod 0700 ~/.ssh
|
|
- echo -e "$SSH_KEY" > ~/.ssh/id_rsa
|
|
- chmod 0600 ~/.ssh/id_rsa
|
|
- echo StrictHostKeyChecking no >> ~/.ssh/config
|
|
- chmod 0600 ~/.ssh/config
|
|
- rsync -rvzc --chmod=g=rwX --delete public/ $USER@$HOST:$WEB_DIR
|
|
|
|
- name: telegram notification
|
|
image: appleboy/drone-telegram
|
|
settings:
|
|
token:
|
|
from_secret: telegram_token
|
|
to:
|
|
from_secret: telegram_to
|
|
format: markdown
|
|
when:
|
|
status:
|
|
- success
|
|
- failure
|
|
message: >
|
|
{{#success build.status}}
|
|
✅ Build #{{build.number}} of `{{repo.name}}` succeeded.
|
|
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
|
|
```
|
|
{{commit.message}}
|
|
```
|
|
🌐 {{ build.link }}
|
|
{{else}}
|
|
❌ Build #{{build.number}} of `{{repo.name}}` failed.
|
|
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
|
|
```
|
|
{{commit.message}}
|
|
```
|
|
🌐 {{ build.link }}
|
|
{{/success}} |