diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..0799b183 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,71 @@ +name: Release + +on: + push: + branches: + - develop + - master + +jobs: + build: + runs-on: windows-latest + continue-on-error: ${{ matrix.arch != 'x86' }} + + strategy: + fail-fast: false + matrix: + arch: + - x86 + - x64 + - arm64 + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v2 + + - name: Build dependencies + run: deps\build.bat --machine ${{matrix.arch}} + + - name: Put git commit hash in version value + run: | + ( + Get-Content -Path src\taiga\config.h + ) -Replace ( + "(?<=#define TAIGA_VERSION_BUILD 0x).*", + (git rev-parse --short HEAD) + ) | Set-Content -Path src\taiga\config.h + + - name: Build Taiga + run: msbuild "project\vs2022\Taiga.sln" /m /p:Configuration=Release /p:Platform=${{matrix.arch}} + + - name: Build installer + run: makensis /DMACHINE=${{matrix.arch}} "setup\Taiga.nsi" + + - name: Rename installer executable + run: mv bin/${{matrix.arch}}/TaigaSetup.exe bin/${{matrix.arch}}/TaigaSetup_${{matrix.arch}}.exe + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: TaigaSetup_${{matrix.arch}} + path: bin/${{matrix.arch}}/TaigaSetup_${{matrix.arch}}.exe + + publish: + runs-on: ubuntu-latest + needs: build + + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + + - name: Publish release + uses: marvinpinto/action-automatic-releases@v1.2.1 + with: + repo_token: "${{secrets.GITHUB_TOKEN}}" + automatic_release_tag: latest + prerelease: true + files: TaigaSetup_*/TaigaSetup_*.exe diff --git a/deps/build.bat b/deps/build.bat index 779290d8..1c2e563d 100644 --- a/deps/build.bat +++ b/deps/build.bat @@ -1,11 +1,11 @@ @echo off -set machine=x86 +set vctarget=x86 set vc=16 :read_arguments if "%1"=="--help" goto help -if "%1"=="--machine" set machine=%2 +if "%1"=="--machine" set vctarget=%2 if "%1"=="--vc" set vc=%2 shift /1 shift /1 @@ -15,7 +15,7 @@ goto locate_vs :help echo Usage: %~nx0 [--machine] [--vc] echo: -echo --machine Target architecture, such as "x86", "x64" or "x64_arm64". +echo --machine Target architecture, such as "x86", "x64" or "arm64". echo --vc Can be "16" ^(VS2019^). Overriden by vswhere, if available. echo: echo Example: %~nx0 --machine=x86 --vc=16 @@ -35,7 +35,12 @@ if exist %vswhere% ( :initialize_environment echo Initializing environment... -call %vcvarsall% %machine% || ( +set vchost=%PROCESSOR_ARCHITECTURE% +if /I %vchost%==amd64 set vchost=x64 +if /I %vctarget%==amd64 set vctarget=x64 +set vcarch=%vctarget% +if /I not %vchost%==%vcarch% set vcarch=%vchost%_%vcarch% +call %vcvarsall% %vcarch% || ( echo Please edit the build script according to your system configuration. exit /B 1 ) @@ -50,18 +55,18 @@ call src\curl\buildconf.bat if exist src\curl\builds ( echo Clearing previous libcurl builds... - for /d %%G in ("src\curl\builds\libcurl-vc%vc%-%machine%-*") do (rmdir /s /q "%%~G") + for /d %%G in ("src\curl\builds\libcurl-vc%vc%-%vctarget%-*") do (rmdir /s /q "%%~G") ) cd src\curl\winbuild\ -echo Building libcurl for Debug^|%machine% configuration... -nmake /f Makefile.vc mode=static RTLIBCFG=static VC=%vc% MACHINE=%machine% DEBUG=yes -xcopy /s ..\builds\libcurl-vc%vc%-%machine%-debug-static-ipv6-sspi-schannel\lib ..\..\..\lib\%machine%\ +echo Building libcurl for Debug^|%vctarget% configuration... +nmake /f Makefile.vc mode=static RTLIBCFG=static VC=%vc% MACHINE=%vctarget% DEBUG=yes +xcopy /s ..\builds\libcurl-vc%vc%-%vctarget%-debug-static-ipv6-sspi-schannel\lib ..\..\..\lib\%vctarget%\ -echo Building libcurl for Release^|%machine% configuration... -nmake /f Makefile.vc mode=static RTLIBCFG=static VC=%vc% MACHINE=%machine% -xcopy /s ..\builds\libcurl-vc%vc%-%machine%-release-static-ipv6-sspi-schannel\lib ..\..\..\lib\%machine%\ +echo Building libcurl for Release^|%vctarget% configuration... +nmake /f Makefile.vc mode=static RTLIBCFG=static VC=%vc% MACHINE=%vctarget% +xcopy /s ..\builds\libcurl-vc%vc%-%vctarget%-release-static-ipv6-sspi-schannel\lib ..\..\..\lib\%vctarget%\ cd /D %currentdir% diff --git a/src/taiga/config.h b/src/taiga/config.h index c3b41403..ca502684 100644 --- a/src/taiga/config.h +++ b/src/taiga/config.h @@ -34,7 +34,7 @@ #define TAIGA_VERSION_MINOR 4 #define TAIGA_VERSION_PATCH 1 #define TAIGA_VERSION_PRE "" -#define TAIGA_VERSION_BUILD 0 +#define TAIGA_VERSION_BUILD 0x0 // Used in version.rc #define TAIGA_VERSION_DIGITAL \ diff --git a/src/taiga/version.cpp b/src/taiga/version.cpp index 9f512eaf..af71d53e 100644 --- a/src/taiga/version.cpp +++ b/src/taiga/version.cpp @@ -16,6 +16,8 @@ ** along with this program. If not, see . */ +#include + #include "taiga/version.h" #include "base/preprocessor.h" @@ -29,7 +31,7 @@ const semaver::Version& version() { TAIGA_VERSION_MINOR, TAIGA_VERSION_PATCH, TAIGA_VERSION_PRE, - TAIGA_VERSION_BUILD > 0 ? STRINGIZE(TAIGA_VERSION_BUILD) : "" + TAIGA_VERSION_BUILD == 0 ? "" : fmt::format("{:x}", TAIGA_VERSION_BUILD) ); return version; }