How to use the netlify.deploy function in netlify

To help you get started, we’ve selected a few netlify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bukinoshita / netlify-docs / lib / deploy.js View on Github external
sites.forEach(async site => {
      if (site.name === siteName) {
        newSite = false
        const site_id = site.id // eslint-disable-line camelcase
        const deployment = netlify.deploy({ access_token, site_id, dir }) // eslint-disable-line camelcase

        return resolve(deployment)
      }
    })
github webex / react-widgets / scripts / deploy / commands / netlify.js View on Github external
handler: ({deployDir, saveUrlPath}) => {
    if (deployDir) {
      const siteId = process.env.NETLIFY_SITE_ID;
      const deployPath = path.resolve(process.cwd(), deployDir);

      if (!deployPath) {
        throw new Error(`No directory found at ${deployPath}`);
      }
      console.log(`Deploying ${deployDir} to ${siteId}`);

      return netlify.deploy({
        access_token: process.env.NETLIFY_ACCESS_TOKEN,
        site_id: siteId,
        dir: deployPath
      })
        .then((deploy) => {
          const deployUrl = deploy.deploy_ssl_url;

          console.log('Deploy successful!');
          console.log(deployUrl);
          if (saveUrlPath) {
            const saveUrl = path.resolve(process.cwd(), saveUrlPath);

            fs.writeFile(saveUrl, deployUrl, (err) => {
              if (err) {
                throw new Error('Could not write URL to file', err);
              }