duanshanduo3363 2016-04-11 08:10
浏览 181
已采纳

Git Post-Push hook替换build文件夹

I'm working with an AngularJS app that I am hosting on Azure as a Web App.

My repository is on Bitbucket, connected as a deployment slot. I use TortoiseGit as a Windows shell for commit/pull/push. Grunt is my task runner.


Problem: I am not managing to replace the build folder after a push has been made. This is what is being exposed on Azure (see picture):

enter image description here


What I've tried:


Currently my solution is that after a push I'm building using grunt build and connecting through FTP with FileZilla and replacing build folder manually.

How can I automate this?

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • dongli7236 2016-04-12 12:21
    关注

    I solved this by refactor my initial batch script that calls:

    npm install 
    bower install 
    grunt clean 
    grunt build
    winscp.com /script=azureBuildScript.txt
    

    and my azureBuildScript.txt:

    option batch abort
    option confirm off
    open ftps://xxx\xxx:xxx@waws-prod-db3-023.ftp.azurewebsites.windows.net/
    cd site/wwwroot
    rmdir %existingFolder%
    put %myFolder%
    exit
    

    This is being triggered Post-Push as a Hook job in TortoiseGit.

    It turns out ftp.exe is restricted regarding passive mode and can't interpret a session whilst WinSCP does this with ease.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发