You can have NixCI automatically deploy your code after a suite succeeds.
You can have NixCI automatically deploy your code after a suite succeeds.
To activate the continuous deployment mechanism, add a
deploy
section to
your NixCI configuration.
For example, this
example
deployment configures the
packages.x86_64-linux.deploy-to-prod
package to be run as a deployment:
{
deploy = {
example = {
package = "packages.x86_64-linux.deploy-to-prod";
};
};
}
In particular, NixCI will
nix run packages.x86_64-linux.deploy-to-prod, which will execute the package's
meta.mainProgram.
Deployments can access secrets and SSH keys as environment variables. See the Secrets & SSH Keys documentation for how to declare and use them.
NixCI also automatically provides git metadata as environment variables during deployments.
deploy: # optional
# default: {}
# Deploy jobs, by name.
<key>:
# DeployConfiguration
enable: # optional
# default: true
# Whether to run this deployment.
<boolean>
package: # required
# package whose main program is run
<string>
system: # optional
# system to run the deployment on
<string>
branches: # optional
# default: :default
# branches to deploy from
# any of
[ # one of
[ # the branches to run on, with nothing excluded
# any of
[ # every ref
:any
, # the repository's default branch
:default
, # every pull request
:pull-requests
, # every merge request
:merge-requests
, # a branch name, or a glob pattern: * matches within one segment, ** across them, ? a single character
<string>
, # Every ref. Deprecated: write :any instead.
any
, # Every ref. Deprecated: write :any instead.
all
, # The repository's default branch. Deprecated: write :default instead.
default
, - # any of
[ # every ref
:any
, # the repository's default branch
:default
, # every pull request
:pull-requests
, # every merge request
:merge-requests
, # a branch name, or a glob pattern: * matches within one segment, ** across them, ? a single character
<string>
, # Every ref. Deprecated: write :any instead.
any
, # Every ref. Deprecated: write :any instead.
all
, # The repository's default branch. Deprecated: write :default instead.
default
]
]
, # BranchFilter
run-on: # optional
# default: :any
# branches to run on
# any of
[ # every ref
:any
, # the repository's default branch
:default
, # every pull request
:pull-requests
, # every merge request
:merge-requests
, # a branch name, or a glob pattern: * matches within one segment, ** across them, ? a single character
<string>
, # Every ref. Deprecated: write :any instead.
any
, # Every ref. Deprecated: write :any instead.
all
, # The repository's default branch. Deprecated: write :default instead.
default
, - # any of
[ # every ref
:any
, # the repository's default branch
:default
, # every pull request
:pull-requests
, # every merge request
:merge-requests
, # a branch name, or a glob pattern: * matches within one segment, ** across them, ? a single character
<string>
, # Every ref. Deprecated: write :any instead.
any
, # Every ref. Deprecated: write :any instead.
all
, # The repository's default branch. Deprecated: write :default instead.
default
]
]
do-not-run-on: # optional
# default: []
# Branches not to run on, even when they are in "run-on".
# any of
[ # every ref
:any
, # the repository's default branch
:default
, # every pull request
:pull-requests
, # every merge request
:merge-requests
, # a branch name, or a glob pattern: * matches within one segment, ** across them, ? a single character
<string>
, # Every ref. Deprecated: write :any instead.
any
, # Every ref. Deprecated: write :any instead.
all
, # The repository's default branch. Deprecated: write :default instead.
default
, - # any of
[ # every ref
:any
, # the repository's default branch
:default
, # every pull request
:pull-requests
, # every merge request
:merge-requests
, # a branch name, or a glob pattern: * matches within one segment, ** across them, ? a single character
<string>
, # Every ref. Deprecated: write :any instead.
any
, # Every ref. Deprecated: write :any instead.
all
, # The repository's default branch. Deprecated: write :default instead.
default
]
]
]
, # true for every ref, false for none
<boolean>
]
in-repo: # optional
# Run the job in a git checkout of the commit being built.
# Defaults to False.
# The checkout has history only when shallow-clone is false.
# Leave this off when the job needs only the repository contents: ${self} refers to the flake source.
<boolean>
secrets: # optional
# default: []
# secrets to provide to the deployment
- <string>
ssh-keys: # optional
# default: []
# SSH keys to provide to the deployment
- # SshKeyConfiguration
secret: # required
# name of the NixCI secret holding the SSH private key
<string>
public-key: # required
# the SSH public key of that private key
<string>