Skip to content

Instantly share code, notes, and snippets.

@apzentral
Last active April 19, 2023 19:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apzentral/761821e59161e97d962155e3b965758b to your computer and use it in GitHub Desktop.
Save apzentral/761821e59161e97d962155e3b965758b to your computer and use it in GitHub Desktop.
ANT: scp template
<!-- Build Script for ANT -->
<project basedir="." default="" name="Build Script">
<property name="username" value="username"/>
<property name="passwd" value="passwd"/>
<property name="keyfile-path" value="/path-to-private-key"/>
<property name="applicationFolder" value="/var/www/html/"/>
<property name="sandboxRoot" value="${basedir}"/>
<property name="development-server" value="server"/>
<property name="development" value="${username}:${passwd}@${development-server}:${applicationFolder}"/>
<property name="production-server" value="server"/>
<property name="production" value="${username}:${passwd}@${production-server}:${applicationFolder}"/>
<!-- Development -->
<fileset id="files-dev" dir="${sandboxRoot}">
<include name="**/.*"/>
<exclude name="**/build.xml"/>
<exclude name="**/.*"/>
</fileset>
<target description="Upload to Development Server: ${development-server}" name="upload-development">
<echo message="--- Start Upload Files to the Development Server - ${development-server} ---"/>
<scp sftp="true" todir="${development}" trust="true" keyfile="${keyfile-path}" verbose="false">
<fileset refid="files-dev"/>
</scp>
<echo message="--- Done ---"/>
</target>
<!-- Production -->
<fileset id="files-production" dir="${sandboxRoot}">
<include name="**/.*"/>
<exclude name="**/build.xml"/>
<exclude name="**/.*"/>
</fileset>
<target description="Upload to Production Server: ${production-server}" name="upload-production">
<echo message="--- Start Upload Files to the Production Server - ${production-server} ---"/>
<scp sftp="true" todir="${production}" trust="true" keyfile="${keyfile-path}" verbose="false">
<fileset refid="files-production"/>
</scp>
<echo message="--- Done ---"/>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment