Skip to content

Commit

Permalink
Package game zip on Windows as an alternative (#2968)
Browse files Browse the repository at this point in the history
This packages a portable version of the game and uploads it to the artifacts.
  • Loading branch information
MatusGuy authored Jul 5, 2024
1 parent d4d88e8 commit da8ed28
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 16 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
run: |
"./$Env:BUILD_TYPE/run_tests.exe"
- name: Package
- name: Package MSI Installer
working-directory: build
env:
BUILD_TYPE: ${{ matrix.build_type }}
Expand All @@ -113,12 +113,37 @@ jobs:
mkdir upload
mv *.msi upload/
- uses: actions/upload-artifact@v4
- name: Upload MSI Installer
uses: actions/upload-artifact@v4
with:
name: "windows-${{ matrix.arch }}-${{ matrix.build_type }}${{ matrix.glbinding == 'ON' && '-glbinding' || '' }}-installer"
path: build/upload/*.msi
if-no-files-found: ignore

- name: Package Portable Archive
working-directory: build
env:
BUILD_TYPE: ${{ matrix.build_type }}
run: |
mkdir -Force SuperTux-${{ github.sha }}-portable
cmake --install . --config $Env:BUILD_TYPE --prefix .\SuperTux-${{ github.sha }}-portable
# Because github puts assets in zips, if you upload a zip,
# it will upload another zip. I have disabled this code because
# of that, but in case you wanted to know how to generate a portable release,
# here it is.
<#
cpack -C $Env:BUILD_TYPE -G ZIP
mv *.zip SuperTux-${{ github.sha }}-portable/
#>
- name: Upload Portable Package
uses: actions/upload-artifact@v4
with:
name: "windows-${{ matrix.arch }}-${{ matrix.build_type }}${{ matrix.glbinding == 'ON' && '-glbinding' || '' }}-portable"
path: build/SuperTux-${{ github.sha }}-portable
if-no-files-found: ignore

- uses: anshulrgoyal/upload-s3-action@master
if: matrix.release && env.CI_KEY != null
env:
Expand Down Expand Up @@ -147,5 +172,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: 'build/upload/SuperTux-*'
files: 'build/upload/SuperTux-*.msi'
draft: true
16 changes: 10 additions & 6 deletions mk/cmake/SuperTux/BuildInstall.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
if(WIN32 AND NOT UNIX)
if(VCPKG_BUILD)
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/" DESTINATION ${INSTALL_SUBDIR_BIN} FILES_MATCHING PATTERN "*.dll")
else()
install(FILES ${DLLS} DESTINATION ${INSTALL_SUBDIR_BIN})
endif()
install(DIRECTORY $<TARGET_FILE_DIR:supertux2_lib>/
DESTINATION ${INSTALL_SUBDIR_BIN}
FILES_MATCHING PATTERN "*.dll")

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.png
${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.ico
DESTINATION ".")

install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.png ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.ico DESTINATION ".")
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mk/msvc/run_supertux.bat
${CMAKE_CURRENT_SOURCE_DIR}/mk/msvc/run_supertux_portable.bat
DESTINATION ".")

option(PACKAGE_VCREDIST "Package the VCREDIST libraries with the program" OFF)

Expand Down
3 changes: 0 additions & 3 deletions mk/cmake/SuperTux/ProvideSquirrel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ else()
IMPORTED_LOCATION "${SQUIRREL_PREFIX}/bin/${CMAKE_SHARED_LIBRARY_PREFIX}sqstdlib${CMAKE_SHARED_LIBRARY_SUFFIX}"
IMPORTED_IMPLIB "${SQUIRREL_PREFIX}/lib/sqstdlib${CMAKE_LINK_LIBRARY_SUFFIX}"
INTERFACE_INCLUDE_DIRECTORIES "${SQUIRREL_PREFIX}/include")

#For debug run purposes
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mk/msvc/run_supertux.bat.in" "${CMAKE_CURRENT_BINARY_DIR}/run_supertux.bat")
else()
add_library(LibSquirrel STATIC IMPORTED)
set_target_properties(LibSquirrel PROPERTIES
Expand Down
2 changes: 2 additions & 0 deletions mk/msvc/run_supertux.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
start %~dp0\bin\supertux2.exe %*
4 changes: 0 additions & 4 deletions mk/msvc/run_supertux.bat.in

This file was deleted.

3 changes: 3 additions & 0 deletions mk/msvc/run_supertux_portable.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
set SUPERTUX2_USER_DIR=%~dp0\user\
start %~dp0\bin\supertux2.exe %*

0 comments on commit da8ed28

Please sign in to comment.