Skip to content

Commit bf3df82

Browse files
authored
Skip deployment when the build context is not production (#18)
1 parent cb9a910 commit bf3df82

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ path = "/api/" # The prefix path to access your deployed packages.
7272

7373
In this section, you will learn how to structure your repository and `netlify.toml` for this plugin to deploy your functions on Nimbella Cloud.
7474

75+
**Note:** Deployment of packages/functions to Nimbella is skipped when the build context is not production. We're working on an enhancement that will allow you to deploy preview builds to staging namespace on Nimbella.
76+
7577
#### Use Nimbella Projects with Netlify Sites
7678

7779
The Nimbella add-on for Netlify allows you to use [Nimbella projects](https://nimbella.io/downloads/nim/nim.html#overview-of-nimbella-projects-actions-and-deployment) to automate packaging and deployment. We suggest reading the documentation about [Nimbella projects](https://nimbella.io/downloads/nim/nim.html#overview-of-nimbella-projects-actions-and-deployment) at some point. We provide a quick introduction here.

index.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,23 @@ module.exports = {
124124
try {
125125
const {stdout: namespace} = await utils.run.command(`nim auth current`);
126126

127-
if (isProject) {
128-
await deployProject(utils.run);
129-
}
127+
if (process.env.CONTEXT === 'production') {
128+
if (isProject) {
129+
await deployProject(utils.run);
130+
}
130131

131-
if (isActions) {
132-
await deployActions({
133-
run: utils.run,
134-
functionsDir: functionsBuildDir,
135-
secretsPath: join(process.cwd(), 'env.json'),
136-
timeout: options.timeout, // Default is 6 seconds
137-
memory: options.memory // Default is 256MB (max for free tier)
138-
});
132+
if (isActions) {
133+
await deployActions({
134+
run: utils.run,
135+
functionsDir: functionsBuildDir,
136+
timeout: options.timeout, // Default is 6 seconds
137+
memory: options.memory // Default is 256MB (max for free tier)
138+
});
139+
}
140+
} else {
141+
console.log(
142+
`Skipping the deployment to Nimbella as the context (${process.env.CONTEXT}) is not production.`
143+
);
139144
}
140145

141146
const redirectRules = [];

0 commit comments

Comments
 (0)