Compare commits

..

No commits in common. "59417f5c2962045a06353d446a5cf8ead43ac6ff" and "f9eaffdaf3fe159628975a1bb7e0d5d09122d589" have entirely different histories.

5 changed files with 53 additions and 43 deletions

View file

@ -1,59 +1,58 @@
local Pipeline(isDev) = { local Pipeline(isDev) = {
kind: "pipeline", kind: "pipeline",
type: "exec", name: if isDev then "deploy-dev" else "deploy-prod",
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: [
{ {
# We want to clone the submodules, which isn't done by default name: "clone",
name: "submodules", image: "plugins/git",
commands: [ recursive: true,
"git submodule update --recursive --init",
]
}, },
{ {
# Include pre-commit checks, which include markdownlint name: "markdownlint",
name: "check", image: "06kellyjac/markdownlint-cli",
commands: [ commands: [
"nix flake check", "markdownlint --version",
"markdownlint content/",
], ],
}, },
{ {
# If dev, include drafts and future articles, change base URL
name: "build", name: "build",
image: "klakegg/hugo",
commands: [ commands: [
"nix develop -c make " + if isDev then "build-dev" else "build-prod", "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", name: "deploy",
commands: [ image: "appleboy/drone-scp",
"nix run github:ambroisie/nix-config#drone-scp", settings: {
], source: "public/*",
environment: { strip_components: 1, # Remove 'public/' suffix from file paths
SCP_SOURCE: "public/*", rm: true, # Remove previous files from target directory
SCP_STRIP_COMPONENTS: 1, # Remove 'public/' suffix from file paths host: { from_secret: "ssh_host" },
SCP_RM: true, # Remove previous files from target directory target: { from_secret: "ssh_target" + if isDev then "_dev" else "" },
SCP_HOST: { from_secret: "ssh_host" }, username: { from_secret: "ssh_user" },
SCP_TARGET: { from_secret: "ssh_target" + if isDev then "_dev" else "" }, key: { from_secret: "ssh_key" },
SCP_USERNAME: { from_secret: "ssh_user" }, port: { from_secret: "ssh_port" },
SCP_KEY: { from_secret: "ssh_key" },
SCP_PORT: { from_secret: "ssh_port" },
}, },
}, },
{ {
name: "notify", name: "notify",
commands: [ image: "plugins/matrix",
"nix run github:ambroisie/matrix-notifier", settings: {
], homeserver: { from_secret: "matrix_homeserver" },
environment: { roomid: { from_secret: "matrix_roomid" },
ADDRESS: { from_secret: "matrix_homeserver" }, username: { from_secret: "matrix_username" },
ROOM: { from_secret: "matrix_roomid" }, password: { from_secret: "matrix_password" },
USER: { from_secret: "matrix_username" },
PASS: { from_secret: "matrix_password" },
}, },
when: { status: [ "failure", "success", ] }, trigger: { status: [ "failure", "success", ] },
}, },
] ]
}; };

View file

@ -1,18 +1,28 @@
.PHONY: all .PHONY: all
all: build-dev all: build
.PHONY: build
build: build-dev
.PHONY: build-dev .PHONY: build-dev
build-dev: build-dev:
HUGO_TITLE="Ambroisie's dev blog" HUGO_BASEURL=https://dev.belanyi.fr hugo -D -F hugo -D -F
.PHONY: build-prod .PHONY: build-prod
build-prod: build-prod:
HUGO_ENV=production hugo --minify HUGO_ENV=production hugo
.PHONY: serve .PHONY: serve
serve: serve: serve-dev
.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

View file

@ -18,16 +18,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1628320020, "lastModified": 1622282707,
"narHash": "sha256-4xBEb+TOHyIGpK37EVsZx6dGPwNMf5YWNBJaQ4VyZws=", "narHash": "sha256-+GOrUDsdneUqrOm9d+9bHXjEVoVcU8tm14WGVzbt6gg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "67c80531be622641b5b2ccc3a7aff355cb02476b", "rev": "6933d068c5d2fcff398e802f7c4e271bbdab6705",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixpkgs-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View file

@ -9,11 +9,12 @@
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 = "nixpkgs-unstable"; ref = "nixos-unstable";
}; };
pre-commit-hooks = { pre-commit-hooks = {

@ -1 +1 @@
Subproject commit 5dab60e04a37896c09a32137aefe821c63b3af04 Subproject commit b43d933019d2789c43914f20242c857f10029611