251 lines
6.1 KiB
YAML
251 lines
6.1 KiB
YAML
---
|
|
kind: pipeline
|
|
name: deps
|
|
type: docker
|
|
|
|
steps:
|
|
- name: install
|
|
image: plugins/docker
|
|
settings:
|
|
registry: docker-registry.ivanli.cc
|
|
username:
|
|
from_secret: ivan-docker-username
|
|
password:
|
|
from_secret: ivan-docker-password
|
|
repo: docker-registry.ivanli.cc/ivan/tailwind-nextjs-blog-deps
|
|
cache_from:
|
|
- docker-registry.ivanli.cc/ivan/tailwind-nextjs-blog-deps:${DRONE_BRANCH}${DRONE_TAG}-amd64
|
|
dockerfile: Dockerfile
|
|
target: deps
|
|
tags:
|
|
- '${DRONE_COMMIT_SHA:0:8}-amd64'
|
|
- '${DRONE_BRANCH}${DRONE_TAG}-amd64'
|
|
|
|
- name: notify
|
|
image: appleboy/drone-telegram
|
|
when:
|
|
status:
|
|
- failure
|
|
failure: ignore
|
|
detach: true
|
|
environment:
|
|
PLUGIN_TOKEN:
|
|
from_secret: drone-telegram-bot-token
|
|
PLUGIN_TO:
|
|
from_secret: telegram-notify-to
|
|
settings:
|
|
format: markdown
|
|
message: >
|
|
{{#success build.status}}
|
|
✅ Install Deps #{{build.number}} of `{{repo.name}}` succeeded.
|
|
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
|
|
```
|
|
{{commit.message}}
|
|
```
|
|
🌐 {{ build.link }}
|
|
{{else}}
|
|
❌ Install Deps #{{build.number}} of `{{repo.name}}` failed.
|
|
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
|
|
```
|
|
{{commit.message}}
|
|
```
|
|
🌐 {{ build.link }}
|
|
{{/success}}
|
|
|
|
---
|
|
kind: pipeline
|
|
name: linux-amd64
|
|
type: docker
|
|
depends_on:
|
|
- deps
|
|
|
|
steps:
|
|
- name: build&publish
|
|
image: plugins/docker
|
|
settings:
|
|
registry: docker-registry.ivanli.cc
|
|
username:
|
|
from_secret: ivan-docker-username
|
|
password:
|
|
from_secret: ivan-docker-password
|
|
repo: docker-registry.ivanli.cc/ivan/tailwind-nextjs-blog
|
|
dockerfile: Dockerfile
|
|
target: release
|
|
cache_from:
|
|
- docker-registry.ivanli.cc/ivan/tailwind-nextjs-blog-deps:${DRONE_BRANCH}${DRONE_TAG}-amd64
|
|
tags:
|
|
- '${DRONE_COMMIT_SHA:0:8}'
|
|
- '${DRONE_BRANCH}${DRONE_TAG}'
|
|
- name: notify
|
|
image: appleboy/drone-telegram
|
|
failure: ignore
|
|
detach: true
|
|
when:
|
|
status:
|
|
- success
|
|
- failure
|
|
environment:
|
|
PLUGIN_TOKEN:
|
|
from_secret: drone-telegram-bot-token
|
|
PLUGIN_TO:
|
|
from_secret: telegram-notify-to
|
|
settings:
|
|
format: markdown
|
|
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}}
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
- main
|
|
- develop
|
|
|
|
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: deploy
|
|
clone:
|
|
disable: false
|
|
depends_on:
|
|
- linux-amd64
|
|
|
|
steps:
|
|
- name: watchtower-online
|
|
image: plugins/webhook
|
|
settings:
|
|
token_value:
|
|
from_secret: watchtower-webhook-token
|
|
token_type: Bearer
|
|
urls: https://watchtower.ivanli.cc/v1/update
|
|
content_type: application/json
|
|
template: |
|
|
{
|
|
"owner": "{{ repo.owner }}",
|
|
"repo": "{{ repo.name }}",
|
|
"status": "{{ build.status }}",
|
|
}
|
|
|
|
- name: notify
|
|
image: appleboy/drone-telegram
|
|
when:
|
|
status:
|
|
- success
|
|
- failure
|
|
failure: ignore
|
|
detach: true
|
|
environment:
|
|
PLUGIN_TOKEN:
|
|
from_secret: drone-telegram-bot-token
|
|
PLUGIN_TO:
|
|
from_secret: telegram-notify-to
|
|
settings:
|
|
format: markdown
|
|
message: >
|
|
{{#success build.status}}
|
|
✅ Deploy #{{build.number}} of `{{repo.name}}` succeeded.
|
|
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
|
|
```
|
|
{{commit.message}}
|
|
```
|
|
🌐 {{ build.link }}
|
|
{{else}}
|
|
❌ Deploy #{{build.number}} of `{{repo.name}}` failed.
|
|
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
|
|
```
|
|
{{commit.message}}
|
|
```
|
|
🌐 {{ build.link }}
|
|
{{/success}}
|
|
|
|
|
|
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: deploy-to-zzidc
|
|
clone:
|
|
disable: false
|
|
depends_on:
|
|
- linux-amd64
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
- develop
|
|
|
|
steps:
|
|
- name: upload
|
|
image: docker:dind
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run/docker.sock
|
|
commands:
|
|
- ls /var/run
|
|
- stat /var/run/docker.sock
|
|
- docker build -t docker-registry.ivanli.cc/ivan/tailwind-nextjs-blog-upload:${DRONE_COMMIT_SHA:0:8} --cache-from docker-registry.ivanli.cc/ivan/tailwind-nextjs-blog-deps:${DRONE_BRANCH}${DRONE_TAG}-amd64 .
|
|
- docker run --rm -t -e FTP_ACCOUNT=${FTP_ACCOUNT} -e FTP_PASSWORD=${FTP_PASSWORD} -e FTP_HOST=${FTP_HOST} docker-registry.ivanli.cc/ivan/tailwind-nextjs-blog-upload:${DRONE_COMMIT_SHA:0:8}
|
|
environment:
|
|
FTP_ACCOUNT:
|
|
from_secret: zzidc_ftp_account
|
|
FTP_PASSWORD:
|
|
from_secret: zzidc_ftp_password
|
|
FTP_HOST:
|
|
from_secret: zzidc_ftp_host
|
|
|
|
- name: notify
|
|
image: appleboy/drone-telegram
|
|
when:
|
|
status:
|
|
- success
|
|
- failure
|
|
failure: ignore
|
|
detach: true
|
|
environment:
|
|
PLUGIN_TOKEN:
|
|
from_secret: drone-telegram-bot-token
|
|
PLUGIN_TO:
|
|
from_secret: telegram-notify-to
|
|
settings:
|
|
format: markdown
|
|
message: >
|
|
{{#success build.status}}
|
|
✅ Deploy #{{build.number}} of `{{repo.name}}` to ZZIDC succeeded.
|
|
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
|
|
```
|
|
{{commit.message}}
|
|
```
|
|
🌐 {{ build.link }}
|
|
{{else}}
|
|
❌ Deploy #{{build.number}} of `{{repo.name}}` to ZZIDC failed.
|
|
📝 Commit by {{commit.author}} on `{{commit.branch}}`:
|
|
```
|
|
{{commit.message}}
|
|
```
|
|
🌐 {{ build.link }}
|
|
{{/success}}
|
|
|
|
services:
|
|
- name: docker
|
|
image: docker:dind
|
|
privileged: true
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run/docker.sock
|
|
|
|
volumes:
|
|
- name: dockersock
|
|
host:
|
|
path: /var/run/docker.sock |