blog/.drone.jsonnet

62 lines
1.6 KiB
Plaintext
Raw Normal View History

local Pipeline(isDev) = {
kind: "pipeline",
2021-08-08 16:24:45 +02:00
type: "exec",
name: if isDev then "Deploy to dev" else "Deploy to 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" ] } },
steps: [
{
2021-08-08 16:24:45 +02:00
# We want to clone the submodules, which isn't done by default
name: "submodules",
commands: [
"git submodule update --recursive --init",
]
},
2020-08-27 17:55:47 +02:00
{
2021-08-08 16:24:45 +02:00
# Include pre-commit checks, which include markdownlint
name: "check",
2020-08-27 17:55:47 +02:00
commands: [
2021-08-08 16:24:45 +02:00
"nix flake check",
2020-08-27 17:55:47 +02:00
],
},
{
2021-08-08 16:24:45 +02:00
# If dev, include drafts and future articles, change base URL
name: "build",
commands: [
2021-08-08 16:24:45 +02:00
"nix develop -c make " + if isDev then "build-dev" else "build-prod",
],
},
{
name: "deploy",
2021-08-08 16:24:45 +02:00
commands: [
"nix develop -c make deploy",
],
environment: {
SSH_HOST: { from_secret: "ssh_host" },
SSH_TARGET: { from_secret: "ssh_target" + if isDev then "_dev" else "" },
SSH_USER: { from_secret: "ssh_user" },
SSH_KEY: { from_secret: "ssh_key" },
},
},
2020-10-14 18:24:26 +02:00
{
name: "notify",
2021-08-08 16:24:45 +02:00
commands: [
"nix run github:ambroisie/matrix-notifier",
],
environment: {
ADDRESS: { from_secret: "matrix_homeserver" },
ROOM: { from_secret: "matrix_roomid" },
USER: { from_secret: "matrix_username" },
PASS: { from_secret: "matrix_password" },
2020-10-14 18:24:26 +02:00
},
2021-08-08 16:24:45 +02:00
when: { status: [ "failure", "success", ] },
2020-10-14 18:24:26 +02:00
},
]
};
[
Pipeline(false),
Pipeline(true),
]