From dbdefc5a95c132c635f4cf31ba5dac69be476118 Mon Sep 17 00:00:00 2001 From: yuriy Date: Tue, 2 Jul 2024 15:14:56 -0400 Subject: [PATCH] Initial version of Release Automation --- Compile and Release.ahk | 125 ++++++++++++++++++ ... Uploader to EXE.ahk => Compile to EXE.ahk | 17 --- Version.ini | 3 +- 3 files changed, 127 insertions(+), 18 deletions(-) create mode 100644 Compile and Release.ahk rename Compile Uploader to EXE.ahk => Compile to EXE.ahk (85%) diff --git a/Compile and Release.ahk b/Compile and Release.ahk new file mode 100644 index 0000000..b4427a5 --- /dev/null +++ b/Compile and Release.ahk @@ -0,0 +1,125 @@ +;---ENVIRONMENT--------------------------------------------------------------------- +#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. +;#Warn ; Enable warnings to assist with detecting common errors. +;DetectHiddenWindows, On +#SingleInstance, Force +DetectHiddenWindows, ON +SendMode Input ; Recommended for new scripts due to its superior speed and reliability. +SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. +;SetKeyDelay, 500 +CoordMode, ToolTip, Screen +CoordMode, Mouse, Screen +; #NoTrayIcon +; Menu, Tray, Icon, RMScriptManager.ico + +;---Notes/Extra Info/#Includes------------------------------------------------------ +; [IniFile] +; FileNameOfAHKScripttoCompile= +; ICOFileName= + + + +;---VARIABLES----------------------------------------------------------------------- + + + +;---MAIN SCRIPT--------------------------------------------------------------------- + +AHKFilepath = %A_ScriptDir%\Freedomain Video Uploader.ahk +Exefilepath = %A_ScriptDir%\Freedomain Video Uploader.exe +icopath = %A_ScriptDir%\Assets\FreedomainVideo.ico +VersionIniFP = %A_ScriptDir%\Version.ini + + + +; Bump the version number in the version.ini file +IniRead, VersionNumber, %VersionIniFP%, Video-Uploader, Version, 0.0 ; , Filename, Section, Key [, Default] +VersionNumber += .01 +VersionNumber := SubStr(VersionNumber, 1, 4) +; Msgbox % "VersionNumber: " VersionNumber +IniWrite, %VersionNumber%, %VersionIniFP%,Video-Uploader, Version + + + +; Kill any active intances of the uploaders so the .exe file can be overwriten by the compilation +process, close, Freedomain Video Uploader.exe + +sleep, 1000 + +; Delete the .exe file so it can be repalced +if(FileExist(Exefilepath)){ + FileDelete, %Exefilepath% + if(ErrorLevel){ + msgbox, failed to delete Exe file. Please delete manually and re-run the compiler. + ExitApp + } +} + + +if(!FileExist(AHKFilepath)){ + msgbox, %AHKFilepath% does not exist`nExiting + ExitApp +} + + +if(!FileExist(icopath)){ + msgbox, %icopath% does not exist`nExiting + ExitApp +} + + +run, %comspec% /c ""C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "%AHKFilepath%" /out "%exefilepath%" /icon "%icopath%"" + + +InputBox, ReleaseBody, Release Body, Please Input Release Body, + + +cred := CredRead("FDR-Gitea-Token") +GiteaToken := Cred.Password + +; Info for Creating the Release with Gitea-CreateRelease.ps1 +PS1Filepath = %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Gitea-CreateRelease.ps1 +APIURL = https://freedomain.dev/api/v1/repos/yuriy/video-uploader/releases?token=%GiteaToken% +ReleaseName := VersionNumber +ReleaseTag := VersionNumber +; ReleaseBody := "-Fixed Item 1--Fixed Item 2--Fixed Item 3" + +Command = Powershell "%PS1Filepath%" "%APIURL%" "%ReleaseName%" "%ReleaseTag%" "%ReleaseBody%" +Clipboard := Command +Msgbox % "Command: " Command +Returned := RunCMD(Command) +Clipboard := Returned +Msgbox % "Returned: " Returned + +; Pull out the relead ID Number, used for uploading attachmenets +SplitText = @{id= +SplitText2 = `; +ReleaseID := StrSplit(Returned, SplitText)[2] +ReleaseID := StrSplit(ReleaseID, SplitText2)[1] + +Clipboard := ReleaseID +Msgbox % "ReleaseID: " ReleaseID + + + +; runcmd() + + + + + +ExitApp + + + + + + + + + + + + + +;---FUNCTIONS----------------------------------------------------------------------- diff --git a/Compile Uploader to EXE.ahk b/Compile to EXE.ahk similarity index 85% rename from Compile Uploader to EXE.ahk rename to Compile to EXE.ahk index 4aa4d98..271c873 100644 --- a/Compile Uploader to EXE.ahk +++ b/Compile to EXE.ahk @@ -14,22 +14,8 @@ CoordMode, Mouse, Screen ;---Notes/Extra Info/#Includes------------------------------------------------------ -; msgbox ;---VARIABLES----------------------------------------------------------------------- -/*ScriptToCompile = %1% -CompileType = %2% ; Testing OR Production -if(CompileType = "") -CompileType = Testing -; Msgbox % "CompileType: " CompileType -if(ScriptToCompile = "") -ExitApp - -*/ - -; Msgbox % "ScriptToCompile: " ScriptToCompile -ScriptToCompile = SocialMediaPoster -; ScriptToCompile = ScriptUpdater ;---MAIN SCRIPT--------------------------------------------------------------------- AHKFilepath = %A_ScriptDir%\Freedomain Video Uploader.ahk @@ -77,9 +63,6 @@ if(!FileExist(icopath)){ run, %comspec% /c ""C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "%AHKFilepath%" /out "%exefilepath%" /icon "%icopath%"" - -; OldNotify(ScriptToCompile,"Compiled Successfully",5) -; sleep, 5000 ExitApp diff --git a/Version.ini b/Version.ini index 601e177..1d227d5 100644 --- a/Version.ini +++ b/Version.ini @@ -1,3 +1,4 @@ [Video-Uploader] -Version=3.41 +Version=3.43 Name=Freedomain Video Uploader +APIURL= \ No newline at end of file