Add secrets
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details

main
mat ess 2022-12-21 23:45:31 -05:00
parent 4ef1b26206
commit 23894ff2b1
1 changed files with 11 additions and 4 deletions

View File

@ -3,6 +3,13 @@ local STAGE = 'staging';
local VOLUME = { name: 'site', path: '/site' }; local VOLUME = { name: 'site', path: '/site' };
local NIX = 'nix --extra-experimental-features nix-command --extra-experimental-features flakes'; local NIX = 'nix --extra-experimental-features nix-command --extra-experimental-features flakes';
local Secrets(secrets) = {
environment: {
[secret]: { from_secret: std.asciiLower(secret) }
for secret in secrets
},
};
local WhenProd(prod) = if prod then { local WhenProd(prod) = if prod then {
event: ['promote'], event: ['promote'],
target: [PROD], target: [PROD],
@ -10,7 +17,7 @@ local WhenProd(prod) = if prod then {
target: { exclude: [PROD] }, target: { exclude: [PROD] },
}; };
local Step(env, name, cmds) = local Step(env, name, cmds, extras={}) =
local prod = env == PROD; local prod = env == PROD;
{ {
name: name + ' ' + env, name: name + ' ' + env,
@ -18,7 +25,7 @@ local Step(env, name, cmds) =
volumes: [VOLUME], volumes: [VOLUME],
commands: cmds, commands: cmds,
when: WhenProd(prod), when: WhenProd(prod),
}; } + extras;
local NixStep(env) = local NixStep(env) =
local prod = env == PROD; local prod = env == PROD;
@ -34,7 +41,7 @@ local DeployStep(env) =
Step(env, 'netlify deploy', [ Step(env, 'netlify deploy', [
NIX + ' profile install nixpkgs#netlify-cli', NIX + ' profile install nixpkgs#netlify-cli',
'netlify deploy -d /site --auth $NETLIFY_TOKEN --site $NETLIFY_SITE_ID --message "$DRONE_COMMIT_MESSAGE" ' + options, 'netlify deploy -d /site --auth $NETLIFY_TOKEN --site $NETLIFY_SITE_ID --message "$DRONE_COMMIT_MESSAGE" ' + options,
]); ], Secrets(['NETLIFY_TOKEN', 'NETLIFY_SITE_ID']));
{ {
kind: 'pipeline', kind: 'pipeline',