暂存区和版本库_如何创建网站的暂存版本

暂存区和版本库

I was in the process of launching a course, and I needed to finalize the landing page that would be up on the “launch day”, without however changing the current version of the site I had up for the public.

我当时正在启动一门课程,我需要完成在“发布日”上将要到达的登录页面,而不更改我为公众准备的网站的当前版本。

I am using Netlify which makes it easy to automatically deploy the website from a Git branch, in my case hosted on GitHub. I will document this process. Other hosting providers that base their CI/CD on a Git repository might have a similar tool in place.

我正在使用Netlify ,它使从Git分支自动部署网站变得容易,在我的案例中,该站点托管在GitHub上 。 我将记录此过程。 其他将其CI / CD基于Git存储库的托管服务提供商可能已经使用了类似的工具。

Netlify automatically builds deploy previews for Pull Requests.

Netlify自动为Pull Requests构建部署预览。

So what I did is, I created a new branch, which I called launch, and started working on it by adding a few commits, then I created a Pull Request, something that GitHub Desktop makes very easy:

所以我要做的是,创建了一个新分支,称为launch ,并通过添加一些提交开始对其进行工作,然后创建了一个Pull Request,这使得GitHub Desktop变得非常容易:

暂存区和版本库_如何创建网站的暂存版本

Immediately after I sent the PR in, Netlify started its Continuous Integration / Continuous Delivery pipeline:

在我发送PR以后,Netlify立即启动了其持续集成/持续交付管道:

暂存区和版本库_如何创建网站的暂存版本

And switching to the Netlify website, I can see it automatically picked up the Pull Request branch, and started a deploy preview:

切换到Netlify网站,我可以看到它自动拾取了Pull Request分支,并开始了部署预览:

暂存区和版本库_如何创建网站的暂存版本

After a few minutes, I got a new URL for the website and I used that to go on with the course launch preparation, while the main domain still pointed to the master branch code.

几分钟后,我获得了该网站的新URL,并使用它进行了课程启动准备,而主域仍指向master分支代码。




翻译自: https://flaviocopes.com/website-staging-version/

暂存区和版本库