You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

make-release.pl 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/perl -w
  2. use strict;
  3. my $usage =
  4. "Usage: make-release.sh <branch> <version> <dir>\n".
  5. " <branch> is new major.minor version, e.g. 4.0\n".
  6. " <version> is new version, e.g. 4.0.1-rc3\n".
  7. " <dir> is dir to store release zip file, e.g. internal/4.0.1-rc/\n";
  8. die ("This is not yet tested, do not use.\n");
  9. my $BRANCH = shift(@ARGV) || die($usage);
  10. my $VERSION = shift(@ARGV) || die($usage);
  11. my $DIR = shift(@ARGV) || die($usage);
  12. my $t = "";
  13. if (!$BRANCH =~ /([4-9]{1}\.[0-9]{1})/) {
  14. die ("<branch> must be format {x}.{y} where {x}=major (4-9), ".
  15. "{y}=minor (0-9).\n");
  16. }
  17. if (
  18. (!$VERSION =~ /[4-9]{1}\.[0-9]{1,2}.[0-9]{1,3}/) &&
  19. (!$VERSION =~ /[4-9]{1}\.[0-9]{1,2}.[0-9]{1,3}-rc[0-9]{1,2}/)
  20. ) {
  21. die ("<version> must be format {x}.{y}.{z} or x.y.z-rc{m} ".
  22. "where {x}=major (4-9), {y}=minor (0-99), {z}=revision ".
  23. "(0-999) and optional release candidate number {m}=(0-99).\n");
  24. }
  25. if (
  26. (!$DIR =~ /release\/[4-9]{1}\.[0-9]{1,2}.[0-9]{1,3}/) &&
  27. (!$DIR =~ /internal\/[4-9]{1}\.[0-9]{1,2}.[0-9]{1,3}-rc[0-9]{1,2}/)
  28. ) {
  29. die ("<dir> must be e.g. internal/4.0.1-rc/ or release/4.0.\n");
  30. }
  31. # go to directory where repository working copies (WC) are
  32. `cd ~/toolkit`;
  33. # it's safest to replace 4.0 from trunk (but you could use also merging)
  34. `svn rm https://svn.itmill.com/svn/itmill-toolkit/branches/$BRANCH -m "Recreating $BRANCH branch from trunk. Removing old $BRANCH."`;
  35. `svn copy https://svn.itmill.com/svn/itmill-toolkit/trunk https://svn.itmill.com/svn/itmill-toolkit/branches/$BRANCH -m "Recreating $BRANCH branch from trunk. Copying new $BRANCH."`;
  36. # checkout $BRANCH
  37. `svn co https://svn.itmill.com/svn/itmill-toolkit/branches/$BRANCH`;
  38. # go to $BRANCH directory
  39. chdir("$BRANCH");
  40. # fix links as VERSION changes
  41. `sed s/cat build/VERSION | cut -f2 -d'='/$VERSION/ index.html >index.html`;
  42. # increment VERSION
  43. `echo "version=$VERSION" >build/VERSION`;
  44. # commit changes
  45. `svn ci -m "Building <VERSION> release."`;
  46. # execute build script, takes 5-40 minutes depending on hw
  47. `ant`;
  48. # copy branch 4.0 into tags directory (some may interpret this as tagging)
  49. `svn copy https://svn.itmill.com/svn/itmill-toolkit/branches/4.0 https://svn.itmill.com/svn/itmill-toolkit/tags/<VERSION> -m "Copying $VERSION into tags."`;
  50. # commit release package zip to SVN
  51. `cp result/itmill-toolkit-$VERSION.zip ~/toolkit/builds/$DIR`;
  52. chdir("~/toolkit/builds/$DIR");
  53. `svn add itmill-toolkit-$VERSION.zip`;
  54. `svn ci -m "Added $VERSION release."`;