Skip to content

Commit

Permalink
Early merge of CI AppImage
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlaux committed Aug 22, 2023
1 parent 29a1b53 commit ec272a5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ name: Continuous Integration
on:
push:
branches: [ master ]
tags-ignore: ['*']
tags: ['*']
paths-ignore: ['**.md']
pull_request:
branches: [ master ]
paths-ignore: ['**.md']
workflow_dispatch:

jobs:
build:
Expand Down Expand Up @@ -103,6 +104,18 @@ jobs:
cd build
cpack
- name: Upload AppImage
if: runner.os == 'Linux'
uses: actions/upload-artifact@v3
with:
name: NuggetDoom-AppImage
path: build/*.appimage

- name: Extract Version Number
if: ${{ contains(github.ref, 'tags') && runner.os == 'Linux' }}
shell: bash
run: echo "VERSION=${GITHUB_REF##*_}" >> $GITHUB_ENV

cppcheck:
name: Cppcheck
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/win_msvc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Artifacts
name: Continuous Integration

on:
push:
Expand Down
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,41 @@ endif()
set(CPACK_PACKAGE_NAME "Nugget-Doom")
if(WIN32)
set(CPACK_GENERATOR ZIP)
elseif(LINUX)
set(CPACK_GENERATOR External)
set(CPACK_EXTERNAL_ENABLE_STAGING YES)
set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${PROJECT_BINARY_DIR}/appimage-generate.cmake")

file(GENERATE
OUTPUT "${PROJECT_BINARY_DIR}/appimage-generate.cmake"
CONTENT [[
find_program(LINUXDEPLOY_EXECUTABLE
NAMES linuxdeploy linuxdeploy-x86_64.AppImage
PATHS ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy)

if(NOT LINUXDEPLOY_EXECUTABLE)
message(STATUS "Downloading linuxdeploy")
set(LINUXDEPLOY_EXECUTABLE ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy/linuxdeploy)
file(DOWNLOAD
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
${LINUXDEPLOY_EXECUTABLE}
INACTIVITY_TIMEOUT 10)
execute_process(COMMAND
chmod +x ${LINUXDEPLOY_EXECUTABLE} COMMAND_ECHO STDOUT)
endif()

execute_process(COMMAND
${CMAKE_COMMAND} -E env
OUTPUT=${CPACK_PACKAGE_FILE_NAME}.appimage
VERSION=$<IF:$<BOOL:${CPACK_PACKAGE_VERSION}>,${CPACK_PACKAGE_VERSION},0.1.0>
${LINUXDEPLOY_EXECUTABLE}
--appimage-extract-and-run
--appdir=${CPACK_TEMPORARY_DIRECTORY}
--executable=$<TARGET_FILE:nugget-doom>
--desktop-file=${CPACK_TEMPORARY_DIRECTORY}/share/applications/nugget-doom.desktop
--icon-file=${CPACK_TEMPORARY_DIRECTORY}/share/icons/hicolor/128x128/apps/nugget-doom.png
--output=appimage)
]])
else()
set(CPACK_GENERATOR TGZ)
endif()
Expand Down

0 comments on commit ec272a5

Please sign in to comment.