Publishing a PEAR package via a PEAR channel is normally done by uploading the package in the channels admin interface.
While not a being very complicated task it asks for automation when releasing regularly.
So I created a small phing task which uploads a package to a channel server:
<target name="deploy" description="Upload package to channel server">
<input propertyname="version" defaultValue="" promptChar="?">Version</input>
<input propertyname="username" defaultValue="" promptChar="?">Channel-Benutzer</input>
<input propertyname="password" defaultValue="" promptChar="?">Channel-Passwort</input>
<property name="channel">http://my-channel-server.com/pearfrontend.php</property>
<property name="uploadFile">_build/PACKAGENAME-${version}.tgz</property>
<exec command="curl -d "login=Submit&password=${password}&user=${username}" --cookie-jar /tmp/deployCookie -s ${channel} > /dev/null"></exec>
<exec command="curl -F release=@${uploadFile} -F submitted=1 -F f=0 -F filename=${uploadFile} --cookie /tmp/deployCookie ${channel} > /tmp/deployCheck"></exec>
</target>
I realize that this task lacks any error handling, so you might want to check your channel server afterwards. However so far this worked very well for me.
Pro tip: This is especially nice at the end of a Jenkins Build Pipeline.
Advertisement