2020-07-21 19:34:57 +02:00
|
|
|
local Pipeline(isDev) = {
|
|
|
|
kind: "pipeline",
|
|
|
|
name: if isDev then "deploy-dev" else "deploy-prod",
|
|
|
|
# Dev ignores "master", prod only triggers on "master"
|
2020-10-23 17:23:54 +02:00
|
|
|
trigger: { branch: { [if isDev then "exclude" else "include"]: [ "main" ] } },
|
2020-07-21 19:34:57 +02:00
|
|
|
# We want to clone the submodules, which isn't done by default
|
|
|
|
clone: { disable: true },
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: "clone",
|
|
|
|
image: "plugins/git",
|
|
|
|
recursive: true,
|
|
|
|
},
|
2020-08-27 17:55:47 +02:00
|
|
|
{
|
|
|
|
name: "markdownlint",
|
|
|
|
image: "06kellyjac/markdownlint-cli",
|
|
|
|
commands: [
|
|
|
|
"markdownlint --version",
|
|
|
|
"markdownlint content/",
|
|
|
|
],
|
|
|
|
},
|
2020-07-21 19:34:57 +02:00
|
|
|
{
|
|
|
|
name: "build",
|
|
|
|
image: "klakegg/hugo",
|
|
|
|
commands: [
|
|
|
|
"hugo version",
|
|
|
|
# If dev, include drafts and future articles, change base URL
|
|
|
|
"hugo --minify" + if isDev then " -D -F -b https://dev.belanyi.fr" else "",
|
|
|
|
],
|
|
|
|
[if !isDev then "environment"]: { HUGO_ENV: "production" }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "deploy",
|
|
|
|
image: "appleboy/drone-scp",
|
|
|
|
settings: {
|
|
|
|
source: "public/*",
|
|
|
|
strip_components: 1, # Remove 'public/' suffix from file paths
|
|
|
|
rm: true, # Remove previous files from target directory
|
|
|
|
host: { from_secret: "ssh_host" },
|
|
|
|
target: { from_secret: "ssh_target" + if isDev then "_dev" else "" },
|
|
|
|
username: { from_secret: "ssh_user" },
|
|
|
|
key: { from_secret: "ssh_key" },
|
|
|
|
port: { from_secret: "ssh_port" },
|
|
|
|
},
|
|
|
|
},
|
2020-10-14 18:24:26 +02:00
|
|
|
{
|
|
|
|
name: "notify",
|
|
|
|
image: "plugins/matrix",
|
|
|
|
settings: {
|
|
|
|
homeserver: { from_secret: "matrix_homeserver" },
|
|
|
|
roomid: { from_secret: "matrix_roomid" },
|
|
|
|
username: { from_secret: "matrix_username" },
|
|
|
|
password: { from_secret: "matrix_password" },
|
|
|
|
},
|
2020-10-20 13:56:09 +02:00
|
|
|
trigger: { status: [ "failure", "success", ] },
|
2020-10-14 18:24:26 +02:00
|
|
|
},
|
2020-07-21 19:34:57 +02:00
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
Pipeline(false),
|
|
|
|
Pipeline(true),
|
|
|
|
]
|