Phing and github

I am trying to automate the deployment of code from a private github repo using phing, but having difficulty trying to find something that works as an SVN export.

I read a few posts in the git and git checkout-index archives, but struggled to get them to work with github. I get the impression that they tend to use zip download as they can cache it, etc.

I would not mind downloading zip from github if a simple task in Phing was done for this, a simple HTTP task did not work with https, and I assume that some authentication is required first.

I managed to use the gitclone task in Phing, but the hidden ".git" folder is also cloned, which causes massive headaches ... mainly because during subsequent builds I cannot delete the build folder, because it offers certain git files, namely * .idx or * .pack.

Anyone lucky with phing and github private rep?

thank

+5
source share
1 answer

@AYK Bad, recently explored deployment options and thought they would roll with Capistrano ...

In any case, it was my build script. I ended up using temporary tips for people ...

  • Suppose my application lives in "C: \ app"
  • Suppose this build.xml file lives in "C: \ app"
  • , git repo "C:\app.git"
  • "C:\app\build" "C:\app\deploy" ,
  • "C:\app\build" "C:\app\deploy" , git checkout
  • git checkout, , git "C:\app\build"
  • , , , , , "C:\app\deploy"

  • , Phing, - scp, ssh2 dll PHP, , .

  • , , Phing, , ,

== build.xml ==

<?xml version="1.0" encoding="UTF-8"?>

<project description="" name="MyProject" default="build" basedir=".">

    <property file="build.properties" />
    <tstamp>
    <format property="build.time" pattern="%Y%m%d_%H%I" />
    </tstamp>

    <!-- ============================================  -->
    <!-- Target: prepare                                 -->
    <!-- ============================================  -->
    <target name="prepare">
    <echo msg="Deleting old build and deploy dirs" />
    <delete dir="./build/" includeemptydirs="true" failonerror="true" />
    <delete dir="./deploy/" includeemptydirs="true" failonerror="true" />
    </target>

    <!-- ============================================  -->
    <!-- Target: create                                -->
    <!-- ============================================  -->
    <target name="create" depends="prepare">
    <echo msg="Creating fresh build and deploy directories" />
    <mkdir dir="./build/" />
    <mkdir dir="./deploy/" />
    </target>

    <!-- ============================================  -->
    <!-- Target: gitclone                              -->
    <!-- ============================================  -->
    <target name="gitcheckout" depends="create">
    <echo msg="Checking out latest code" />
    <exec command="git checkout-index --prefix ./build/ -a"></exec>
    </target>

    <!-- ============================================  -->
    <!-- Target: preparedeploy                         -->
    <!-- ============================================  -->
    <target name="preparedeploy" depends="gitcheckout">
    <echo msg="Preparing deploy" />
    <copy todir="./deploy/" >
        <fileset dir=".">
        <include name="cgi-bin/**" />
        <include name="htdocs/**" />
        </fileset>
    </copy>
    <mkdir dir="./deploy/logs" />
    </target>

    <!-- ============================================  -->
    <!-- Target: cleanup                                 -->
    <!-- ============================================  -->
    <target name="cleanup" depends="preparedeploy">
    <echo msg="Deleting build dir" />
    <delete dir="./build/" includeemptydirs="true" failonerror="true" />
    </target>

    <!-- ============================================  -->
    <!-- Target: build                                 -->
    <!-- ============================================  -->
    <target name="build" depends="cleanup, preparedeploy, gitcheckout, create, prepare">
    <echo msg="Starting build ${build.time}" />
    </target>

</project>
+4

All Articles