如何自动部署源&编译代码(不包括git历史)给第三方开发者? [英] How to automate deployment of source & compiled code (excluding git history) to third-party developers?

查看:233
本文介绍了如何自动部署源&编译代码(不包括git历史)给第三方开发者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要设置一些工具/技术/环境,当我需要为第三方开发人员提供源代码时,我没有git历史记录,一些敏感代码已经编译和剥离。所以我想自动化这个过程,所以我总是提供它的最新版本,而不用每次都手动执行所有必要的步骤的痛苦。
我使用bitbucket和git。

I'm going to setup some tools/techiques/environments so that when I need to provide the source code for third-party developers, I do it without git history with some sensitive code already compiled and stripped. So I want to automate this process, so that I always provide the latest version of it without the pain of doing all necessary steps by hands everytime. I use bitbucket and git.

我的目标如何使用bitbucket和git来实现?我需要其他工具吗?

如果它没有说明清楚的想法,随意编辑的问题。

P.S. Feel free to edit the question if it doesn't state clear the idea. I hope this questions is not too broad and doesn't fall under restrictions

推荐答案

听起来你想要写一些 post-commit hook。但这可能是太细粒度给你。只需将自动步骤写入 .git / hooks / post-commit ,并使其成为可执行文件。您可以

Sounds like you want to write some post-commit hook. But that might be too fine grained for you. Just write the automatic steps to .git/hooks/post-commit and make that executable. You can

git --work-tree PATH_FOR_THIRD_PARTY checkout HEAD -- PUBLIC_FILES

为PATH_FOR_THIRD_PARTY中的第三方开发人员更新PUBLIC_FILES,其中我假设您为第三方开发人员发布了数据。

to update the PUBLIC_FILES for your third-party developers in PATH_FOR_THIRD_PARTY, where I assume you publish the data for the third-party developers.

然后,为了更新编译结果,你写了一些Makefile(或类似的)来产生PATH_FOR_THIRD_PARTY从你的隐藏文件中的输出。

Then to update the compiled results you shoud write some Makefile (or similar) to produce the output in the PATH_FOR_THIRD_PARTY from your hidden files.

如果您为存储库选择了正确的布局,只需使用PUBLIC_FILES目录,即可将所有PUBLIC_FILES检出为 PATH_FOR_THIRD_PARTY / PUBLIC_FILES

If you chose the right layout for your repository can just use a PUBLIC_FILES directory, to checkout all PUBLIC_FILES to PATH_FOR_THIRD_PARTY/PUBLIC_FILES.

请注意,使用此方法,目录布局在发布目录和存储库中将是相同的。

Note that with this method the directory layout will be the same in the publishing directory and in your repository.

BTW:如果第三方开发人员更改在其目录中的PUBLIC_FILE,您可以简单地

BTW.: If a third-party developer changes a PUBLIC_FILE in their directory, you can simply

git --work-tree PATH_FOR_THIRD_PARTY add -u

我经常使用这个方法从git仓库发布文件。你可以简单地

I use this method often to publish files from a git repository. You can simply

git config -g alias.public '!git --work-tree $(git config --get public.root) '
git config public.root 'PATH_FOR_THIRD_PARTY'

/ p>

so you can say

git public diff --name-only

git public status -s -uno

我认为这个方法被称为或类似于一个分离的工作树。

I think this method is known as or similar to a detached work-tree.

如果您使用此方法,您需要在执行公共提交后签出本地存储库中的文件:

If you use this method you need to checkout the files in your local repository after you did a public commit:

git public add -u; git public commit -m "John Doe changed something"
git checkout HEAD -- .

最后一行更新您的本地工作树以与上面提交的提交一致。

The last line updates you local work tree to align with the commit you did above.

这篇关于如何自动部署源&编译代码(不包括git历史)给第三方开发者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆