2022-10-20 22:40:22 +00:00
|
|
|
local Volume = { name: 'site', path: '/site' };
|
|
|
|
local NetlifyStep(env, prod) = {
|
|
|
|
name: 'netlify deploy ' + env,
|
|
|
|
image: 'internetmat/drone-netlify',
|
|
|
|
volumes: [Volume],
|
|
|
|
settings: {
|
|
|
|
token: { from_secret: 'netlify_token' },
|
|
|
|
site: { from_secret: 'netlify_site_id' },
|
|
|
|
path: '/site',
|
|
|
|
prod: prod,
|
|
|
|
},
|
2022-10-20 22:49:27 +00:00
|
|
|
when: if prod then {
|
|
|
|
event: ['promote'],
|
|
|
|
target: ['prod'],
|
2022-10-20 22:53:35 +00:00
|
|
|
} else {
|
|
|
|
target: { exclude: ['prod'] },
|
2022-10-20 22:49:27 +00:00
|
|
|
},
|
2022-10-20 22:40:22 +00:00
|
|
|
};
|
|
|
|
{
|
|
|
|
kind: 'pipeline',
|
|
|
|
type: 'docker',
|
|
|
|
name: 'default',
|
|
|
|
|
|
|
|
environment: {
|
|
|
|
NIX: 'nix --extra-experimental-features nix-command --extra-experimental-features flakes',
|
|
|
|
},
|
|
|
|
|
|
|
|
volumes: [{ name: 'site', temp: {} }],
|
|
|
|
|
|
|
|
steps: [
|
|
|
|
{
|
|
|
|
name: 'nix build',
|
|
|
|
image: 'nixos/nix',
|
|
|
|
volumes: [Volume],
|
|
|
|
commands: [
|
|
|
|
'$NIX build',
|
|
|
|
'cp -r result/* /site/',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
NetlifyStep('staging', false),
|
2022-10-20 22:40:47 +00:00
|
|
|
NetlifyStep('prod', true),
|
2022-10-20 22:40:22 +00:00
|
|
|
],
|
|
|
|
}
|