Skip to content

Commit

Permalink
Add package CI on "v*" tag push.
Browse files Browse the repository at this point in the history
  • Loading branch information
karnkaul committed Jul 5, 2024
1 parent 5c20c2d commit efed18f
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: package
on:
push:
tags:
- 'v*'
jobs:
package-linux:
runs-on: ubuntu-24.04
env:
PACKAGE_NAME: NovaSwarm-x64-linux-v0.1.0.zip
steps:
- uses: actions/checkout@v4
- name: init
run: sudo apt update -yqq && sudo apt install -yqq ninja-build xorg-dev
- name: package release
run: cmake -DPACKAGE_NAME=$PACKAGE_NAME -P tools/package_release.cmake
- name: upload release
uses: softprops/action-gh-release@v2
with:
files: $PACKAGE_NAME
draft: true
package-windows:
runs-on: windows-latest
env:
PACKAGE_NAME: NovaSwarm-x64-windows-v0.1.0.zip
steps:
- uses: actions/checkout@v4
- name: init
run: choco install ninja
- name: package release
run: cmake -DPACKAGE_NAME=$env:PACKAGE_NAME -P tools/package_release.cmake
- name: upload release
uses: softprops/action-gh-release@v2
with:
files: $PACKAGE_NAME
draft: true
package-macos:
runs-on: macos-latest
env:
CPU_ARCH: arm64
OS_NAME: macos
PACKAGE_NAME: NovaSwarm-arm64-macos-v0.1.0.zip
steps:
- uses: actions/checkout@v4
- name: init
run: brew install ninja
- name: package release
run: cmake -DPACKAGE_NAME=$PACKAGE_NAME -P tools/package_release.cmake
- name: upload release
uses: softprops/action-gh-release@v2
with:
files: $PACKAGE_NAME
draft: true

2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ message(STATUS "spaced build version: ${build_version}")

project(spaced VERSION ${build_version})

configure_file(src/package.yml.in "${CMAKE_CURRENT_SOURCE_DIR}/.github/workflows/package.yml" @ONLY)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down
54 changes: 54 additions & 0 deletions src/package.yml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: package
on:
push:
tags:
- 'v*'
jobs:
package-linux:
runs-on: ubuntu-24.04
env:
PACKAGE_NAME: NovaSwarm-x64-linux-v@PROJECT_VERSION@.zip
steps:
- uses: actions/checkout@v4
- name: init
run: sudo apt update -yqq && sudo apt install -yqq ninja-build xorg-dev
- name: package release
run: cmake -DPACKAGE_NAME=$PACKAGE_NAME -P tools/package_release.cmake
- name: upload release
uses: softprops/action-gh-release@v2
with:
files: $PACKAGE_NAME
draft: true
package-windows:
runs-on: windows-latest
env:
PACKAGE_NAME: NovaSwarm-x64-windows-v@PROJECT_VERSION@.zip
steps:
- uses: actions/checkout@v4
- name: init
run: choco install ninja
- name: package release
run: cmake -DPACKAGE_NAME=$env:PACKAGE_NAME -P tools/package_release.cmake
- name: upload release
uses: softprops/action-gh-release@v2
with:
files: $PACKAGE_NAME
draft: true
package-macos:
runs-on: macos-latest
env:
CPU_ARCH: arm64
OS_NAME: macos
PACKAGE_NAME: NovaSwarm-arm64-macos-v@PROJECT_VERSION@.zip
steps:
- uses: actions/checkout@v4
- name: init
run: brew install ninja
- name: package release
run: cmake -DPACKAGE_NAME=$PACKAGE_NAME -P tools/package_release.cmake
- name: upload release
uses: softprops/action-gh-release@v2
with:
files: $PACKAGE_NAME
draft: true

9 changes: 8 additions & 1 deletion tools/package_release.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ set(build_dir out/release)
message(STATUS "building to: ${build_dir}")

message(STATUS "configuring")
execute_process(COMMAND ${CMAKE_COMMAND} -S . -B ${build_dir} --preset=default

if(WIN32)
set(preset vs22)
else()
set(preset default)
endif()

execute_process(COMMAND ${CMAKE_COMMAND} -S . -B ${build_dir} --preset=${preset}
COMMAND_ERROR_IS_FATAL ANY
)

Expand Down

0 comments on commit efed18f

Please sign in to comment.