Commit e703d083 authored by Jamie Tanna's avatar Jamie Tanna

Blogument `netlify` branch deployments

Plus update the previous GitLab CI + Netlify article to inform.
parent b4254c8d
Pipeline #152563750 passed with stages
in 11 minutes and 32 seconds
......@@ -19,6 +19,8 @@ slug: gitlab-ci-netlify
**Update 2** as of [2018-09-10](https://www.netlify.com/blog/2018/09/10/netlify-cli-2.0-now-in-beta/#our-cli-journey), the `netlify` Node CLI is back to being the preferred commandline interface for Netlify.
**Update 3** as of [2020-06-03]({{< ref 2020-06-03-netlify-cli-branch >}}) it is now possible to use the `netlify` Node CLI to perform branch-based deployments, which is a great fit for using with GitLab review apps - if you're able to predict the full URL Netlify uses, that is.
Since I migrated my [meetups + conference talks repo][gl-talks] to Reveal.JS, I've found that I've been wanting to have a branch spun up with the talk's content at a publically accessible URL, exactly how [I have configured Review Apps][review-apps] for my personal site.
However, as I was using GitLab pages, I wasn't able to get this functionality working (and it [likely will not be configured upstream][gl-pages-review]). Recently I've been hearing a lot about [Netlify], which made this a perfect opportunity to see what everyone was raving about.
......
---
title: "Deploying a Branch to Netlify on the Command-Line"
description: "How to use Netlify's Node CLI to deploy a given branch to Netlify."
tags:
- blogumentation
- netlify
- netlify-cli
license_code: Apache-2.0
license_prose: CC-BY-NC-SA-4.0
date: 2020-06-03T19:40:19+0100
slug: "netlify-cli-branch"
image: /img/vendor/netlify-full-logo-white.png
---
I'm very excited to say that the Netlify CLI tool ([<i class="fa fa-github"></i>&nbsp;netlify/cli](https://github.com/netlify/cli)) [now](https://github.com/netlify/cli/pull/907) has the ability to deploy a branch on the command-line.
This has been a feature request since [at least 2018](https://github.com/netlify/cli/issues/44) and has been greatly anticipated from the community, and I've been wanting to use it for some time when using [GitLab CI]({{< ref 2018-04-12-gitlab-ci-netlify >}}) pipelines.
As of [netlify-cli@2.53.0](https://www.npmjs.com/package/netlify-cli/v/2.53.0), it's now possible to deploy using the `-b $branchName` flag:
```
% netlify deploy -b wibble
Deploy path: /home/jamie/workspaces/talks/public
Configuration path: /home/jamie/workspaces/talks/netlify.toml
Deploying to draft URL...
✔ Finished hashing 286 files
✔ CDN requesting 0 files
✔ Finished uploading 0 assets
✔ Deploy is live!
Logs: https://app.netlify.com/sites/epic-wozniak-9aa019/deploys/5ed7eaedb88cedbb42a9d341
Website Draft URL: https://wibble--epic-wozniak-9aa019.netlify.app
If everything looks good on your draft URL, deploy it to your main site URL with the --prod flag.
netlify deploy --prod
```
This is super exciting, and will help help folks deploying from Continuous Integration platforms, or with use cases where they don't want to use Netlify's Webhook integrations.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment