Compare commits
6 commits
f9eaffdaf3
...
59417f5c29
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | 59417f5c29 | ||
Bruno BELANYI | ab3e1ca30d | ||
Bruno BELANYI | e96fbee9dd | ||
Bruno BELANYI | bd20edffc5 | ||
Bruno BELANYI | 549c396776 | ||
Bruno BELANYI | 70a460aede |
|
@ -1,58 +1,59 @@
|
||||||
local Pipeline(isDev) = {
|
local Pipeline(isDev) = {
|
||||||
kind: "pipeline",
|
kind: "pipeline",
|
||||||
name: if isDev then "deploy-dev" else "deploy-prod",
|
type: "exec",
|
||||||
|
name: if isDev then "Deploy to dev" else "Deploy to prod",
|
||||||
# Dev ignores "master", prod only triggers on "master"
|
# Dev ignores "master", prod only triggers on "master"
|
||||||
trigger: { branch: { [if isDev then "exclude" else "include"]: [ "main" ] } },
|
trigger: { branch: { [if isDev then "exclude" else "include"]: [ "main" ] } },
|
||||||
# We want to clone the submodules, which isn't done by default
|
|
||||||
clone: { disable: true },
|
|
||||||
steps: [
|
steps: [
|
||||||
{
|
{
|
||||||
name: "clone",
|
# We want to clone the submodules, which isn't done by default
|
||||||
image: "plugins/git",
|
name: "submodules",
|
||||||
recursive: true,
|
commands: [
|
||||||
|
"git submodule update --recursive --init",
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "markdownlint",
|
# Include pre-commit checks, which include markdownlint
|
||||||
image: "06kellyjac/markdownlint-cli",
|
name: "check",
|
||||||
commands: [
|
commands: [
|
||||||
"markdownlint --version",
|
"nix flake check",
|
||||||
"markdownlint content/",
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
# If dev, include drafts and future articles, change base URL
|
||||||
name: "build",
|
name: "build",
|
||||||
image: "klakegg/hugo",
|
|
||||||
commands: [
|
commands: [
|
||||||
"hugo version",
|
"nix develop -c make " + if isDev then "build-dev" else "build-prod",
|
||||||
# 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",
|
name: "deploy",
|
||||||
image: "appleboy/drone-scp",
|
commands: [
|
||||||
settings: {
|
"nix run github:ambroisie/nix-config#drone-scp",
|
||||||
source: "public/*",
|
],
|
||||||
strip_components: 1, # Remove 'public/' suffix from file paths
|
environment: {
|
||||||
rm: true, # Remove previous files from target directory
|
SCP_SOURCE: "public/*",
|
||||||
host: { from_secret: "ssh_host" },
|
SCP_STRIP_COMPONENTS: 1, # Remove 'public/' suffix from file paths
|
||||||
target: { from_secret: "ssh_target" + if isDev then "_dev" else "" },
|
SCP_RM: true, # Remove previous files from target directory
|
||||||
username: { from_secret: "ssh_user" },
|
SCP_HOST: { from_secret: "ssh_host" },
|
||||||
key: { from_secret: "ssh_key" },
|
SCP_TARGET: { from_secret: "ssh_target" + if isDev then "_dev" else "" },
|
||||||
port: { from_secret: "ssh_port" },
|
SCP_USERNAME: { from_secret: "ssh_user" },
|
||||||
|
SCP_KEY: { from_secret: "ssh_key" },
|
||||||
|
SCP_PORT: { from_secret: "ssh_port" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "notify",
|
name: "notify",
|
||||||
image: "plugins/matrix",
|
commands: [
|
||||||
settings: {
|
"nix run github:ambroisie/matrix-notifier",
|
||||||
homeserver: { from_secret: "matrix_homeserver" },
|
],
|
||||||
roomid: { from_secret: "matrix_roomid" },
|
environment: {
|
||||||
username: { from_secret: "matrix_username" },
|
ADDRESS: { from_secret: "matrix_homeserver" },
|
||||||
password: { from_secret: "matrix_password" },
|
ROOM: { from_secret: "matrix_roomid" },
|
||||||
|
USER: { from_secret: "matrix_username" },
|
||||||
|
PASS: { from_secret: "matrix_password" },
|
||||||
},
|
},
|
||||||
trigger: { status: [ "failure", "success", ] },
|
when: { status: [ "failure", "success", ] },
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
18
Makefile
18
Makefile
|
@ -1,28 +1,18 @@
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: build
|
all: build-dev
|
||||||
|
|
||||||
.PHONY: build
|
|
||||||
build: build-dev
|
|
||||||
|
|
||||||
.PHONY: build-dev
|
.PHONY: build-dev
|
||||||
build-dev:
|
build-dev:
|
||||||
hugo -D -F
|
HUGO_TITLE="Ambroisie's dev blog" HUGO_BASEURL=https://dev.belanyi.fr hugo -D -F
|
||||||
|
|
||||||
.PHONY: build-prod
|
.PHONY: build-prod
|
||||||
build-prod:
|
build-prod:
|
||||||
HUGO_ENV=production hugo
|
HUGO_ENV=production hugo --minify
|
||||||
|
|
||||||
.PHONY: serve
|
.PHONY: serve
|
||||||
serve: serve-dev
|
serve:
|
||||||
|
|
||||||
.PHONY: serve-dev
|
|
||||||
serve-dev:
|
|
||||||
hugo server -D -F
|
hugo server -D -F
|
||||||
|
|
||||||
.PHONY: serve-prod
|
|
||||||
serve-prod:
|
|
||||||
hugo server
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
$(RM) -r public
|
$(RM) -r public
|
||||||
|
|
|
@ -18,16 +18,16 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1622282707,
|
"lastModified": 1628320020,
|
||||||
"narHash": "sha256-+GOrUDsdneUqrOm9d+9bHXjEVoVcU8tm14WGVzbt6gg=",
|
"narHash": "sha256-4xBEb+TOHyIGpK37EVsZx6dGPwNMf5YWNBJaQ4VyZws=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "6933d068c5d2fcff398e802f7c4e271bbdab6705",
|
"rev": "67c80531be622641b5b2ccc3a7aff355cb02476b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-unstable",
|
"ref": "nixpkgs-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,11 @@
|
||||||
ref = "master";
|
ref = "master";
|
||||||
};
|
};
|
||||||
|
|
||||||
# https://nixpk.gs/pr-tracker.html?pr=124808
|
|
||||||
nixpkgs = {
|
nixpkgs = {
|
||||||
type = "github";
|
type = "github";
|
||||||
owner = "NixOS";
|
owner = "NixOS";
|
||||||
repo = "nixpkgs";
|
repo = "nixpkgs";
|
||||||
ref = "nixos-unstable";
|
ref = "nixpkgs-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
pre-commit-hooks = {
|
pre-commit-hooks = {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit b43d933019d2789c43914f20242c857f10029611
|
Subproject commit 5dab60e04a37896c09a32137aefe821c63b3af04
|
Loading…
Reference in a new issue