Despite my primitive Linux and BASH script writing skills I managed to come up with something that worked last April (K2 Nightly Build snapshot copies in TAR and ZIP files).
Amazingly, it still runs perfectly well on the specific given time (1:00am GMT +8) controlled by crontab. As far as I know, it only fails me once which I think it’s due to connection timeout between this server and K2 Subversion server. It wouldn’t be much of a problem if both are hosted on the same machine.
How does this work?
Before everything is controlled by crontab, first I’d to manually svn checkout the latest copy from K2 development repository to folder local. When the crontab schedule is set and the time comes, the script will do svn info on both my current copies and K2 development repository to grab the revision number. This way it could compare and determine whether the K2 on the development repository has the same revision number or higher.
Now comes the tricky part. If my current copy has the same revision number, it will do nothing. But if it’s higher than my current copies:
- Execute svn update on folder local.
- Duplicate the folder local and named it to k2.
- Remove all .svn folders inside folder k2.
- Create a TAR archive and ZIP archive from folder k2.
- Move both archives to www directory.
- Execute svn log against folder local and dump the entire output to a file (CHANGELOG) and move it to www directory. Same directory where the TAR and ZIP archives is located.
- Delete folder k2.
Note: My current K2 folder on this server named as local and the duplicate folder for distribution is named as k2.
Enough with the explanations. Now show me the script!
Please be noted that this is for educational purpose only. You may freely adapt and modified the script to suit your own project. Use at your own risk.
Dude, I can show you a better way
Please feel free to dive in if you have anything to add or suggestion. Even better if you host an Open source project and would like share your own nightly build snapshot script (if any).
Hi,
I just used Your script, added a few lines to match my requirements. So it automatized building k2 nightlies with Hungarian language files.
Thank You!