Index: other-projects/nightly-tasks/snapshot/trunk/aliases.txt
===================================================================
--- other-projects/nightly-tasks/snapshot/trunk/aliases.txt	(revision 28321)
+++ other-projects/nightly-tasks/snapshot/trunk/aliases.txt	(revision 29346)
@@ -1,2 +1,3 @@
+release
 gs2-caveat
 gs2-stable
Index: other-projects/nightly-tasks/snapshot/trunk/lib.pl
===================================================================
--- other-projects/nightly-tasks/snapshot/trunk/lib.pl	(revision 28321)
+++ other-projects/nightly-tasks/snapshot/trunk/lib.pl	(revision 29346)
@@ -25,4 +25,96 @@
 	}
 	return get_date();
+}
+
+sub create_release {
+
+	die "Must provide parameter to create_release\n" unless (exists $_[0]);
+	
+	my $release_folder_name = $_[0];
+	my $release_dir = "$ENV{'DATA_DIR'}${sep}$release_folder_name";		
+	
+	my $release_version = $release_folder_name;
+	$release_version =~ s/^gs-?//;
+	$release_version =~ s/rc\d$//;
+	my $major_version = $release_version;
+	$major_version =~ s/^(3|2).*/$1/;	
+	$release_version =~ s/^($major_version)\.?(\d*).*/$1.$2/;
+	my $rk = "rk".$major_version;
+	
+	my $release_version_extra;
+	if ($release_folder_name =~ m/(rc\d)$/) {
+		$release_version_extra = $1;
+	}
+	if ($release_folder_name !~ m/^gs/) { # prefix gs
+		$release_folder_name = "gs".$release_folder_name;
+	}
+	
+	print "major_version: $major_version\n";
+	print "version: $release_version\n";
+	print "versionextra: $release_version_extra\n";
+	print "release_folder_name: $release_folder_name\n";	
+	
+	print "about to clean up old snapshots (Ctrl-C to cancel)";
+	local $| = 1;
+	for ( my $i=0; $i<5; $i++ ) {
+		print ".";
+		sleep 1;
+	}
+	$| = 0;
+
+	print "cleaning up previous release snapshot $release_dir\n";
+	
+	if(-d $release_dir) {
+		if ( $^O eq "MSWin32" ) {
+			system("rd /q /s \"$release_dir\"");
+		} else {
+			system("rm -rf \"$release_dir\"");
+		}
+	}
+		
+	print "creating the release dir\n";	
+	mkdir $release_dir or die "couldn't create release directory\n";
+
+	print "changing to the release dir\n";
+	chdir $release_dir;
+
+	#version property
+ 	print "setting up todays properties\n";
+	`echo version:$release_version> $rk-build.properties`;
+
+	if($release_version_extra) {
+		`echo version-extra:$release_version_extra>> $rk-build.properties`;
+	}	
+	
+	#processor propertylocal $| = 1;
+	if ( $^O eq "darwin" ) {
+		print "setting processor\n";
+		if ( `uname -p` eq "i386" ) {
+			`echo processor:intel>> $rk-build.properties`;
+		} elsif ( `uname -p` eq "powerpc" ) {
+			`echo processor:ppc>> $rk-build.properties`;
+		} else {
+			print "unable to determine processor type, using intel\n";
+			`echo processor:intel>> $rk-build.properties`;
+		}
+	} elsif ( $^O eq "linux" ) {
+		if(`uname -m` =~ m/64$/) {
+			print "Setting linux architecture to 64 bit";
+			`echo x64:true>> $rk-build.properties`;
+		}		
+	}
+
+	#branch path property
+	if ( $ENV{'branch_path'} ) {
+		`echo branch.path:$ENV{'branch_path'}>> $rk-build.properties`;
+	}
+
+	#server.exe.location
+	if ( $major_version eq "2" && exists $ENV{'SERVER_EXE_LOCATION'} ) {
+		`echo server.exe.location:$ENV{'SERVER_EXE_LOCATION'}>> $rk-build.properties`;
+	}
+
+	print "creating the snapshot using $rk\n";
+	system( $rk );
 }
 
Index: other-projects/nightly-tasks/snapshot/trunk/task.pl
===================================================================
--- other-projects/nightly-tasks/snapshot/trunk/task.pl	(revision 28321)
+++ other-projects/nightly-tasks/snapshot/trunk/task.pl	(revision 29346)
@@ -49,5 +49,12 @@
 
 #choose the parameters of the build based on the task name
-if ( $ENV{'TASK_NAME'} =~ "gs2-(caveat|stable)" ) {
+if ( $ENV{'TASK_NAME'} =~ "release" ) { # run as release 306rc1 (or as different as gs-3.06-rc1)
+	if(exists $ARGV[0] && $ARGV[0] =~ m/^(gs-?)?(3|2)\.?\d\d+-?rc\d$/) {		
+		create_release($ARGV[0]);
+		exit;
+	} else {
+		die "Run snapshot task with gs<full-version>[rc#]\n";
+	}	
+} elsif ( $ENV{'TASK_NAME'} =~ "gs2-(caveat|stable)" ) {
 	$major_version = 2;
 	$prefix="2s";
