mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 12:31:15 +00:00
Moved all packaging logic into CMake, fixed SemVer, and implemented pipeline caching
This commit is contained in:
parent
6be0ea36a1
commit
8c65477bb3
24
.github/workflows/release.yml
vendored
24
.github/workflows/release.yml
vendored
@ -11,6 +11,7 @@ env:
|
||||
APT_CACHE_DIRS: |
|
||||
/var/cache/apt/
|
||||
/var/lib/apt/lists/
|
||||
BUILD_DIR: build
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -81,9 +82,15 @@ jobs:
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Cache CMakeCache.txt
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.BUILD_DIR }}/CMakeCache.txt
|
||||
key: ${{ matrix.name }}-${{ hashFiles('**/CMakeLists.txt,**/*.cmake') }}
|
||||
|
||||
- name: Configure (CMake)
|
||||
run: |
|
||||
${{ matrix.cmake-wrapper || '' }} cmake -S . -B build -GNinja \
|
||||
${{ matrix.cmake-wrapper || '' }} cmake -S . -B ${{ env.BUILD_DIR }} -GNinja \
|
||||
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
|
||||
-DISLE_USE_DX5=${{ !!matrix.dx5 }} \
|
||||
-DISLE_BUILD_CONFIG=${{ matrix.config }} \
|
||||
@ -93,11 +100,11 @@ jobs:
|
||||
-Werror=dev
|
||||
|
||||
- name: Build (CMake)
|
||||
run: cmake --build build --verbose
|
||||
run: cmake --build ${{ env.BUILD_DIR }} --verbose
|
||||
|
||||
- name: Package (CPack)
|
||||
run: |
|
||||
cd build
|
||||
cd ${{ env.BUILD_DIR }}
|
||||
cpack .
|
||||
|
||||
- name: Upload Artifact
|
||||
@ -105,7 +112,7 @@ jobs:
|
||||
with:
|
||||
name: Release-${{ matrix.name }}
|
||||
path: |
|
||||
build/dist/isle-*
|
||||
${{ env.BUILD_DIR }}/dist/isle-*
|
||||
|
||||
flatpak:
|
||||
name: "Flatpak (${{ matrix.arch }})"
|
||||
@ -128,14 +135,17 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Configure Package Scripts
|
||||
run: cmake -S . -B build_config -GNinja -DCONFIGURE_FLATPAK=ON
|
||||
- name: Cache .flatpak-builder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .flatpak-builder
|
||||
key: ${{ matrix.arch }}-${{ hashFiles('packaging/linux/flatpak/isledecomp.manifest.json.in') }}
|
||||
|
||||
- name: Build Flatpak
|
||||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
|
||||
with:
|
||||
bundle: ${{ env.APP_ID }}.${{ matrix.arch }}.flatpak
|
||||
manifest-path: build_config/packaging/linux/${{ env.APP_ID }}.json
|
||||
manifest-path: packaging/linux//flatpak${{ env.APP_ID }}.json
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
release:
|
||||
|
||||
@ -2,15 +2,6 @@ cmake_minimum_required(VERSION 3.25...4.0 FATAL_ERROR)
|
||||
|
||||
project(isle LANGUAGES CXX C VERSION 0.1)
|
||||
|
||||
option(CONFIGURE_FLATPAK "Configure required Flatpak data and exit" OFF)
|
||||
if (NOT DEFINED ENV{FLATPAK_DEST})
|
||||
add_subdirectory(packaging EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
if (CONFIGURE_FLATPAK)
|
||||
# Exit early since the remaining configuration will otherwise fail
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
add_compile_options(-pthread)
|
||||
add_link_options(-sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=2gb -sUSE_PTHREADS=1 -sPROXY_TO_PTHREAD=1 -sPTHREAD_POOL_SIZE_STRICT=0 -sFORCE_FILESYSTEM=1 -sWASMFS=1 -sEXIT_RUNTIME=1)
|
||||
@ -652,6 +643,8 @@ if(EMSCRIPTEN)
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectory(packaging)
|
||||
|
||||
set(CPACK_PACKAGE_DIRECTORY "dist")
|
||||
set(CPACK_PACKAGE_FILE_NAME "isle-${PROJECT_VERSION}-${ISLE_PACKAGE_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||
if(MSVC)
|
||||
|
||||
@ -2,19 +2,27 @@ set(APP_ID "org.legoisland.Isle")
|
||||
set(APP_NAME "Isle Portable")
|
||||
set(APP_SUMMARY "Portable version of the LEGO Island Decompilation Project")
|
||||
set(APP_SPDX "LGPL-3.0-or-later")
|
||||
set(QT_VERSION 6.8)
|
||||
|
||||
string(TIMESTAMP BUILD_DATE UTC)
|
||||
|
||||
# The following will need to be refined if we wish to post actual releases to a repo such as Flathub
|
||||
if(DEFINED ENV{GITHUB_RUN_ATTEMPT})
|
||||
# Use the sequential run# of the current pipeline when running in GH Actions
|
||||
set(SEMANTIC_VERSION "${PROJECT_VERSION}~build$ENV{GITHUB_RUN_ATTEMPT}")
|
||||
else()
|
||||
# Don't worry about the build number for local builds
|
||||
set(SEMANTIC_VERSION "${PROJECT_VERSION}")
|
||||
endif()
|
||||
|
||||
# Following block sourced from https://jonathanhamberg.com/post/cmake-embedding-git-hash/
|
||||
# Get the latest abbreviated commit hash of the working branch
|
||||
execute_process(
|
||||
COMMAND git log -1 --format=%h
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
OUTPUT_VARIABLE GIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
# execute_process(
|
||||
# COMMAND git log -1 --format=%h
|
||||
# WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
# OUTPUT_VARIABLE GIT_HASH
|
||||
# OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
# )
|
||||
|
||||
# TODO: Generate minfied SVG icon and PNG variants
|
||||
|
||||
add_subdirectory(linux EXCLUDE_FROM_ALL)
|
||||
if(LINUX)
|
||||
add_subdirectory(linux)
|
||||
endif()
|
||||
@ -1,8 +1,13 @@
|
||||
if(DEFINED ENV{FLATPAK_DEST})
|
||||
set(METADATA_ROOT "$ENV{FLATPAK_DEST}/share")
|
||||
else()
|
||||
set(METADATA_ROOT "/usr/share")
|
||||
endif()
|
||||
|
||||
# Injects the required variables into the Desktop and MetaInfo files
|
||||
configure_file(isledecomp.desktop.in "${APP_ID}.desktop" @ONLY)
|
||||
configure_file(isledecomp.metainfo.xml.in "${APP_ID}.metainfo.xml" @ONLY)
|
||||
|
||||
# Injects the required variables into the Flatpak manifest
|
||||
if (CONFIGURE_FLATPAK)
|
||||
configure_file(flatpak/isledecomp.manifest.json.in "${APP_ID}.json" ESCAPE_QUOTES @ONLY)
|
||||
endif()
|
||||
install(FILES "../icons/isle.svg" RENAME "${APP_ID}.svg" DESTINATION "${METADATA_ROOT}/icons/hicolor/scalable/apps/")
|
||||
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${APP_ID}.desktop" DESTINATION "${METADATA_ROOT}/applications/")
|
||||
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/${APP_ID}.metainfo.xml" DESTINATION "${METADATA_ROOT}/metainfo/")
|
||||
@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install Desktop assets and Icons in a Flatpak build environment
|
||||
|
||||
APP_ID=$1
|
||||
|
||||
# Set up main constants
|
||||
ICON_INSTALL_DIR="${FLATPAK_DEST}/share/icons/hicolor"
|
||||
ICON_SIZES=(64 128) # TODO: Figure out why only the first element is being checked
|
||||
|
||||
# Rename and install SVG icon
|
||||
mv icons/isle.svg "icons/${APP_ID}.svg"
|
||||
install -Dm0644 "icons/${APP_ID}.svg" -t "${ICON_INSTALL_DIR}/scalable/apps/"
|
||||
|
||||
# Rename and install optional PNG icons
|
||||
for size in $ICON_SIZES; do
|
||||
icon="icons/${APP_ID}_${size}.png"
|
||||
if [ ! -f "${icon}" ]; then
|
||||
# Skip if icon doesn't exist
|
||||
echo "\"${icon}\" not present. Skipping..."
|
||||
continue
|
||||
fi
|
||||
mv "${icon}" "icons/${APP_ID}.png"
|
||||
|
||||
icon="icons/${APP_ID}.png"
|
||||
size_sq="${size}x${size}"
|
||||
target_dir="${ICON_INSTALL_DIR}/${size_sq}/apps/"
|
||||
|
||||
mkdir -p "${target_dir}"
|
||||
install -Dm0644 "${icon}" -t "${target_dir}"
|
||||
echo "Installed ${size_sq} icon"
|
||||
done
|
||||
|
||||
# Install Desktop file and AppStream data
|
||||
install -Dm0644 "${APP_ID}.desktop" -t "${FLATPAK_DEST}/share/applications/"
|
||||
install -Dm0644 "${APP_ID}.metainfo.xml" -t "${FLATPAK_DEST}/share/metainfo/"
|
||||
@ -1,9 +1,9 @@
|
||||
{
|
||||
"id": "@APP_ID@",
|
||||
"id": "org.legoisland.Isle",
|
||||
|
||||
"runtime": "org.kde.Platform",
|
||||
"sdk": "org.kde.Sdk",
|
||||
"runtime-version": "@QT_VERSION@",
|
||||
"runtime-version": "6.8",
|
||||
|
||||
"command": "isle",
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
"--device=input",
|
||||
"--filesystem=/run/media/:ro",
|
||||
"--filesystem=/media/:ro",
|
||||
"--filesystem=/mnt/:ro"
|
||||
"--filesystem=/mnt/:ro",
|
||||
"--filesystem=home:ro"
|
||||
],
|
||||
|
||||
"modules": [
|
||||
@ -30,47 +31,52 @@
|
||||
"sources": [
|
||||
{
|
||||
"type": "dir",
|
||||
"path": "@PROJECT_SOURCE_DIR@/3rdparty",
|
||||
"path": "../../../3rdparty",
|
||||
"dest": "3rdparty/"
|
||||
},
|
||||
{
|
||||
"type": "dir",
|
||||
"path": "@PROJECT_SOURCE_DIR@/cmake",
|
||||
"path": "../../../cmake",
|
||||
"dest": "cmake/"
|
||||
},
|
||||
{
|
||||
"type": "dir",
|
||||
"path": "@PROJECT_SOURCE_DIR@/CMake",
|
||||
"path": "../../../CMake",
|
||||
"dest": "CMake/"
|
||||
},
|
||||
{
|
||||
"type": "dir",
|
||||
"path": "@PROJECT_SOURCE_DIR@/CONFIG",
|
||||
"path": "../../../CONFIG",
|
||||
"dest": "CONFIG/"
|
||||
},
|
||||
{
|
||||
"type": "dir",
|
||||
"path": "@PROJECT_SOURCE_DIR@/ISLE",
|
||||
"path": "../../../ISLE",
|
||||
"dest": "ISLE/"
|
||||
},
|
||||
{
|
||||
"type": "dir",
|
||||
"path": "@PROJECT_SOURCE_DIR@/LEGO1",
|
||||
"path": "../../../LEGO1",
|
||||
"dest": "LEGO1/"
|
||||
},
|
||||
{
|
||||
"type": "dir",
|
||||
"path": "@PROJECT_SOURCE_DIR@/miniwin",
|
||||
"path": "../../../miniwin",
|
||||
"dest": "miniwin/"
|
||||
},
|
||||
{
|
||||
"type": "dir",
|
||||
"path": "@PROJECT_SOURCE_DIR@/util",
|
||||
"path": "../../../packaging",
|
||||
"dest": "packaging/"
|
||||
},
|
||||
{
|
||||
"type": "dir",
|
||||
"path": "../../../util",
|
||||
"dest": "util/"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"path": "@PROJECT_SOURCE_DIR@/CMakeLists.txt"
|
||||
"path": "../../../CMakeLists.txt"
|
||||
}
|
||||
],
|
||||
"build-options": {
|
||||
@ -78,34 +84,6 @@
|
||||
"--share=network"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "desktop-assets",
|
||||
"buildsystem": "simple",
|
||||
"sources": [
|
||||
{
|
||||
"type": "dir",
|
||||
"dest": "icons",
|
||||
"path": "@CMAKE_CURRENT_SOURCE_DIR@/../icons/"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"path": "./@APP_ID@.desktop"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"path": "./@APP_ID@.metainfo.xml"
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"path": "@CMAKE_CURRENT_SOURCE_DIR@/flatpak/install_desktop_assets.sh",
|
||||
"dest-filename": "fp_install.sh"
|
||||
}
|
||||
],
|
||||
"build-commands": [
|
||||
"chmod +x ./fp_install.sh",
|
||||
"./fp_install.sh @APP_ID@"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -84,6 +84,6 @@
|
||||
</keywords>
|
||||
|
||||
<releases>
|
||||
<release version="@PROJECT_VERSION@+@GIT_HASH@" type="development" date="@BUILD_DATE@"/>
|
||||
<release version="@SEMANTIC_VERSION@" type="development" date="@BUILD_DATE@"/>
|
||||
</releases>
|
||||
</component>
|
||||
Loading…
Reference in New Issue
Block a user