Official Everybody Edits Forums

Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?

You are not logged in.

#1 2017-01-19 12:17:17, last edited by LukeM (2017-01-19 18:27:45)

LukeM
Member
From: England
Joined: 2016-06-03
Posts: 3,009
Website

[Tool] Easier bot releases

I just thought I would post this windows bat file I wrote to make it a bit easier to create new versions of a bot (its a bit annoying using click-once or having to find and copy the exe files and PlayerIOClient every time you make a change, then zipping the file to upload it)
Feel free to modify, or even repost this if you want to make a change or whatever
Hope this helps some people like it helps me //forums.everybodyedits.com/img/smilies/big_smile

I have left in all of my directories as an example, (the 4 lines after @echo off)

@echo off

set VERSIONDIR=G:\Luke\Visual Studio\Published Programs
set RELEASEDIR=G:\Luke\Visual Studio\Projects\DigBot4\DigBot4\bin\Release
set PROJECTNAME=DigBot4
set VERSIONNAME=DigBot

for /f "delims== tokens=1,2" %%G in (version.txt) do set %%G=%%H
if defined VERSION (
  if defined REVISION (
    if defined BUGFIX (
      goto gettype
    )
  )
)

goto getversion

:gettype
echo Options:
echo 1: New version
echo 2: New revision
echo 3: New bugfix
echo 4: Cancel
set /p choice=Choice: 

if %choice%==1 goto addversion
if %choice%==2 goto addrevision
if %choice%==3 goto addbugfix
goto end

:getversion
set /p VERSION=Version: 
set /p REVISION=Revision: 
set /p BUGFIX=Bugfix: 
goto update

:addversion
set /a VERSION=%VERSION%+1
set REVISION=0
set BUGFIX=0
goto update

:addrevision
set /a REVISION=%REVISION%+1
set BUGFIX=0
goto update

:addbugfix
set /a BUGFIX=%BUGFIX%+1
goto update

:update
set NAME=%VERSIONDIR%\%VERSIONNAME%_%VERSION%_%REVISION%_%BUGFIX%
if exist "%NAME%" goto versionexists
mkdir "%NAME%"
copy "%RELEASEDIR%\%PROJECTNAME%.exe" "%NAME%\%PROJECTNAME%.exe"
copy "%RELEASEDIR%\%PROJECTNAME%.exe.config" "%NAME%\%PROJECTNAME%.exe.config"
copy "%RELEASEDIR%\PlayerIOClient.dll" "%NAME%\PlayerIOClient.dll"
powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%VERSIONNAME%.lnk');$s.TargetPath='%NAME%\%PROJECTNAME%.exe';$s.Save()"
goto save

:versionexists
echo Version %VERSION%_%REVISION%_%BUGFIX% already exists
goto end

:save
(
  echo VERSION^=%VERSION%
  echo REVISION^=%REVISION%
  echo BUGFIX^=%BUGFIX%
)>version.txt

echo.
set /p tozip=zip release? 
if "%tozip:~0,1%"=="y" powershell "Compress-Archive -Path '%NAME%' -DestinationPath %VERSIONNAME%_%VERSION%_%REVISION%_%BUGFIX%.zip"

:end
echo.
pause

This will take a visual studio build, and copy the needed files to a new directory, with a new version number depending on whether you select version, revision or bugfix
This will not replace directories if they are already there, so you dont need to worry about accidentally deleting an old version
The format for this is NAME_VERSION_REVISION_BIGFIX e.g. DigBot_4_5_2

When you first use this, it will assume that it is a new bot, so will start at 0_0_0 then will add one to the number coresponding to the option you select
If you are not using this for a new bot, you will probably want to run it once, then delete the folder it creates, and change the version numbers in the version.txt file it creates

This also gives you an option to zip the file, which moves the folder to a new zip file in the folder the script is in, ready to be uploaded


How to use it:
1. Copy the script into a .bat file in its own folder (mine is in a folder on my desktop)
2. Change the first 4 variables depending on your project directory / name / where you want the versions to be put
3. If there are additional libraries / files you wish to be copied into the version folder, add extra COPY commands after the PlayerIOClient one (use this as an example)
4. Run the .bat file
5. Enter the version number, version then revision then bugfix (each is on a new line) (I'd advise 0, 0, 1 for a new alpha bot, 0, 1, 0 for beta, and 1, 0, 0 for full release)
6. Type y or n depending on whether you want it to be zipped ready to be uploaded
7. When you create a new versions, build them from visual studio or whatever, then run the bat file and enter what type of release it is, then repeat steps 6 and onwards

Notes on release type:
  A new version usually means a large change to the bot, for example redoing a large part of the code
  A revision usually means a smaller change, like adding a new feature
  A bugfix usually means fixing a problem with the previous version, for example something that caused it to crash

Offline

Wooted by:

#2 2017-01-19 12:36:13

LukeM
Member
From: England
Joined: 2016-06-03
Posts: 3,009
Website

Re: [Tool] Easier bot releases

reserved

Offline

LukeM1484825773643620

Board footer

Powered by FluxBB

[ Started around 1711703189.2649 - Generated in 0.025 seconds, 10 queries executed - Memory usage: 1.34 MiB (Peak: 1.42 MiB) ]