2016-04-27 16 views
0

プロダクションサーバでプロジェクトのフットプリントを削減しようとしています。私はそのような操作のための専門家ではないが、私は次のbashスクリプトを思いついた。プライベートGithubリポジトリからダウンロード

VERSION=$1 
rm -rf pydata 

# clone the entire github repository. This is kind of inefficient as we delete the .git folder in a moment 
git clone [email protected]:tt/pydata.git 

cd pydata 

# checkout the correct version 
git checkout $VERSION -- 

# Print the version into a txt file 
echo $VERSION > version.txt 

# Build the Python environment using conda 
make build 

# delete a bunch of files not needed on the server but contained in the git repository (documentation etc.) 
xargs rm -rf < delete.txt 
rm delete.txt 

# back into the folder 
cd .. 

最新のタグを見つけるためのエレガントな方法があります(ユーザーが希望のタグを提供していない場合($ 1))?

小さなリサーチでは、git担当者全体を複製し、.gitフォルダを削除すると、githubでサポートされていないgitアーカイブを使用する方が良いでしょうか?

代わりにtar.gzアーカイブのwgetを使用しますか?これは、.gitフォルダのダウンロードを避けるだろうが、SSHをサポートしていないので、あらゆる種類の頭痛を引き起こすようだ。あなたがgit describeを使用することができ、最新のgitタグを取得するには

おかげ

+1

私は、別個の「リリース」ブランチからリリースを使用することをお勧めします。 Githubの最新APIを入手するためのAPIもあります:https://developer.github.com/v3/repos/releases/#get-the-latest-release – rinukkusu

答えて

1

if [ ''$VERSION = '' ] 
then 
    VERSION=$(git describe) 
fi 
関連する問題