Versioning improvements (#768)
Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
# ignore git files
|
|
||||||
.git*
|
|
||||||
|
|
||||||
# ignore hidden files
|
# ignore hidden files
|
||||||
.*
|
.*
|
||||||
|
|
||||||
|
# do not ignore .git, needed for versioning
|
||||||
|
!/.git
|
||||||
|
|
||||||
# ignore repo directories and files
|
# ignore repo directories and files
|
||||||
docs/
|
docs/
|
||||||
scripts/
|
scripts/
|
||||||
|
|||||||
24
.github/workflows/CI.yml
vendored
24
.github/workflows/CI.yml
vendored
@@ -46,6 +46,7 @@ jobs:
|
|||||||
last_version: ${{ steps.verify_changelog.outputs.latest_release_tag_name }}
|
last_version: ${{ steps.verify_changelog.outputs.latest_release_tag_name }}
|
||||||
release_body: ${{ steps.verify_changelog.outputs.changelog_parser_description }}
|
release_body: ${{ steps.verify_changelog.outputs.changelog_parser_description }}
|
||||||
|
|
||||||
|
# todo - remove this job once versioning is fully automated by cmake
|
||||||
check_versions:
|
check_versions:
|
||||||
name: Check Versions
|
name: Check Versions
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -362,6 +363,10 @@ jobs:
|
|||||||
sudo rm /root/cuda.run
|
sudo rm /root/cuda.run
|
||||||
|
|
||||||
- name: Build Linux
|
- name: Build Linux
|
||||||
|
env:
|
||||||
|
BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||||
|
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
|
||||||
|
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
mkdir -p artifacts
|
mkdir -p artifacts
|
||||||
@@ -485,6 +490,10 @@ jobs:
|
|||||||
ln -sf /usr/local/opt/openssl/include/openssl /usr/local/include/openssl
|
ln -sf /usr/local/opt/openssl/include/openssl /usr/local/include/openssl
|
||||||
|
|
||||||
- name: Build MacOS
|
- name: Build MacOS
|
||||||
|
env:
|
||||||
|
BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||||
|
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
|
||||||
|
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||||
run: |
|
run: |
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
@@ -590,7 +599,8 @@ jobs:
|
|||||||
|
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DGITHUB_COMMIT=${commit} \
|
cmake \
|
||||||
|
-DGITHUB_COMMIT=${commit} \
|
||||||
-DGITHUB_CLONE_URL=${clone_url} \
|
-DGITHUB_CLONE_URL=${clone_url} \
|
||||||
-DSUNSHINE_CONFIGURE_PORTFILE=ON \
|
-DSUNSHINE_CONFIGURE_PORTFILE=ON \
|
||||||
-DSUNSHINE_CONFIGURE_ONLY=ON \
|
-DSUNSHINE_CONFIGURE_ONLY=ON \
|
||||||
@@ -641,6 +651,8 @@ jobs:
|
|||||||
echo "subportlist=${subportlist}" >> $GITHUB_OUTPUT
|
echo "subportlist=${subportlist}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Run port lint for all subports
|
- name: Run port lint for all subports
|
||||||
|
env:
|
||||||
|
subportlist: ${{ steps.subportlist.outputs.subportlist }}
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
fail=0
|
fail=0
|
||||||
@@ -662,10 +674,10 @@ jobs:
|
|||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
done
|
done
|
||||||
exit "$fail"
|
exit "$fail"
|
||||||
env:
|
|
||||||
subportlist: ${{ steps.subportlist.outputs.subportlist }}
|
|
||||||
|
|
||||||
- name: Build subports
|
- name: Build subports
|
||||||
|
env:
|
||||||
|
subportlist: ${{ steps.subportlist.outputs.subportlist }}
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
fail=0
|
fail=0
|
||||||
@@ -714,8 +726,6 @@ jobs:
|
|||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
done
|
done
|
||||||
exit "$fail"
|
exit "$fail"
|
||||||
env:
|
|
||||||
subportlist: ${{ steps.subportlist.outputs.subportlist }}
|
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
run: |
|
run: |
|
||||||
@@ -795,6 +805,10 @@ jobs:
|
|||||||
|
|
||||||
- name: Build Windows
|
- name: Build Windows
|
||||||
shell: msys2 {0}
|
shell: msys2 {0}
|
||||||
|
env:
|
||||||
|
BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||||
|
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
|
||||||
|
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.18)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
# `CMAKE_CUDA_ARCHITECTURES` requires 3.18
|
# `CMAKE_CUDA_ARCHITECTURES` requires 3.18
|
||||||
|
|
||||||
|
# todo - set version to 0.0.0 once confident in automated versioning
|
||||||
project(Sunshine VERSION 0.18.4
|
project(Sunshine VERSION 0.18.4
|
||||||
DESCRIPTION "Sunshine is a self-hosted game stream host for Moonlight."
|
DESCRIPTION "Sunshine is a self-hosted game stream host for Moonlight."
|
||||||
HOMEPAGE_URL "https://app.lizardbyte.dev")
|
HOMEPAGE_URL "https://app.lizardbyte.dev")
|
||||||
@@ -10,6 +11,65 @@ and Nvidia GPUs for hardware encoding. Software encoding is also available. You
|
|||||||
Moonlight client on a variety of devices. A web UI is provided to allow configuration, and client pairing, from \
|
Moonlight client on a variety of devices. A web UI is provided to allow configuration, and client pairing, from \
|
||||||
your favorite web browser. Pair from the local server or any mobile device.")
|
your favorite web browser. Pair from the local server or any mobile device.")
|
||||||
|
|
||||||
|
# Check if env vars are defined before attempting to access them, variables will be defined even if blank
|
||||||
|
if((DEFINED ENV{BRANCH}) AND (DEFINED ENV{BUILD_VERSION}) AND (DEFINED ENV{COMMIT})) # cmake-lint: disable=W0106
|
||||||
|
if(($ENV{BRANCH} STREQUAL "master") AND (NOT $ENV{BUILD_VERSION} STREQUAL ""))
|
||||||
|
# If BRANCH is "master" and BUILD_VERSION is not empty, then we are building a master branch
|
||||||
|
MESSAGE("Got from CI master branch and version $ENV{BUILD_VERSION}")
|
||||||
|
set(PROJECT_VERSION $ENV{BUILD_VERSION})
|
||||||
|
elseif((DEFINED ENV{BRANCH}) AND (DEFINED ENV{COMMIT}))
|
||||||
|
# If BRANCH is set but not BUILD_VERSION we are building nightly, we gather only the commit hash
|
||||||
|
MESSAGE("Got from CI $ENV{BRANCH} branch and commit $ENV{COMMIT}")
|
||||||
|
set(PROJECT_VERSION ${PROJECT_VERSION}.$ENV{COMMIT})
|
||||||
|
endif()
|
||||||
|
# Generate Sunshine Version based of the git tag
|
||||||
|
# https://github.com/nocnokneo/cmake-git-versioning-example/blob/master/LICENSE
|
||||||
|
else()
|
||||||
|
find_package(Git)
|
||||||
|
if(GIT_EXECUTABLE)
|
||||||
|
MESSAGE("${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
get_filename_component(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
|
||||||
|
#Get current Branch
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
||||||
|
#WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE GIT_DESCRIBE_BRANCH
|
||||||
|
RESULT_VARIABLE GIT_DESCRIBE_ERROR_CODE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
# Gather current commit
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||||
|
#WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE GIT_DESCRIBE_VERSION
|
||||||
|
RESULT_VARIABLE GIT_DESCRIBE_ERROR_CODE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
# Check if Dirty
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${GIT_EXECUTABLE} diff --quiet --exit-code
|
||||||
|
#WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
RESULT_VARIABLE GIT_IS_DIRTY
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
if(NOT GIT_DESCRIBE_ERROR_CODE)
|
||||||
|
MESSAGE("Sunshine Branch: ${GIT_DESCRIBE_BRANCH}")
|
||||||
|
if(NOT GIT_DESCRIBE_BRANCH STREQUAL "master")
|
||||||
|
set(PROJECT_VERSION ${PROJECT_VERSION}.${GIT_DESCRIBE_VERSION})
|
||||||
|
MESSAGE("Sunshine Version: ${GIT_DESCRIBE_VERSION}")
|
||||||
|
endif()
|
||||||
|
if(GIT_IS_DIRTY)
|
||||||
|
set(PROJECT_VERSION ${PROJECT_VERSION}.dirty)
|
||||||
|
MESSAGE("Git tree is dirty!")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
MESSAGE(ERROR ": Got git error while fetching tags: ${GIT_DESCRIBE_ERROR_CODE}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
MESSAGE(WARNING ": Git not found, cannot find git version")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
option(SUNSHINE_CONFIGURE_APPIMAGE "Configuration specific for AppImage." OFF)
|
option(SUNSHINE_CONFIGURE_APPIMAGE "Configuration specific for AppImage." OFF)
|
||||||
option(SUNSHINE_CONFIGURE_AUR "Configure files required for AUR." OFF)
|
option(SUNSHINE_CONFIGURE_AUR "Configure files required for AUR." OFF)
|
||||||
option(SUNSHINE_CONFIGURE_FLATPAK_MAN "Configure manifest file required for Flatpak build." OFF)
|
option(SUNSHINE_CONFIGURE_FLATPAK_MAN "Configure manifest file required for Flatpak build." OFF)
|
||||||
@@ -75,7 +135,7 @@ pkg_check_modules(CURL REQUIRED libcurl)
|
|||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(Boost_USE_STATIC_LIBS ON) # cmake-lint: disable=C0103
|
set(Boost_USE_STATIC_LIBS ON) # cmake-lint: disable=C0103
|
||||||
# workaround to prevent link errors against icudata, icui18n
|
# workaround to prevent link errors against icudata, icui18n
|
||||||
set(Boost_NO_BOOST_CMAKE ON) # cmake-lint: disable=C0103
|
set(Boost_NO_BOOST_CMAKE ON) # cmake-lint: disable=C0103
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Boost COMPONENTS locale log filesystem program_options REQUIRED)
|
find_package(Boost COMPONENTS locale log filesystem program_options REQUIRED)
|
||||||
@@ -396,7 +456,7 @@ ${CMAKE_BINARY_DIR}/generated-src/${filename}.h")
|
|||||||
configure_file(sunshine.service.in sunshine.service @ONLY)
|
configure_file(sunshine.service.in sunshine.service @ONLY)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
configure_file(version.h.in version.h @ONLY)
|
configure_file(src/version.h.in version.h @ONLY)
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
set(SUNSHINE_TARGET_FILES
|
set(SUNSHINE_TARGET_FILES
|
||||||
|
|||||||
@@ -22,11 +22,16 @@ RUN useradd -m builder && \
|
|||||||
|
|
||||||
FROM sunshine-base as sunshine-build
|
FROM sunshine-base as sunshine-build
|
||||||
|
|
||||||
|
ARG BRANCH
|
||||||
ARG BUILD_VERSION
|
ARG BUILD_VERSION
|
||||||
ARG COMMIT
|
ARG COMMIT
|
||||||
ARG CLONE_URL
|
ARG CLONE_URL
|
||||||
# note: BUILD_VERSION may be blank
|
# note: BUILD_VERSION may be blank
|
||||||
|
|
||||||
|
ENV BRANCH=${BRANCH}
|
||||||
|
ENV BUILD_VERSION=${BUILD_VERSION}
|
||||||
|
ENV COMMIT=${COMMIT}
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
# install dependencies
|
# install dependencies
|
||||||
# cuda, libcap, and libdrm are optional dependencies for PKGBUILD
|
# cuda, libcap, and libdrm are optional dependencies for PKGBUILD
|
||||||
@@ -37,6 +42,7 @@ pacman -Syu --noconfirm \
|
|||||||
base-devel \
|
base-devel \
|
||||||
cmake \
|
cmake \
|
||||||
cuda \
|
cuda \
|
||||||
|
git \
|
||||||
libcap \
|
libcap \
|
||||||
libdrm \
|
libdrm \
|
||||||
namcap
|
namcap
|
||||||
|
|||||||
@@ -14,6 +14,15 @@ FROM sunshine-base as sunshine-build
|
|||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
RUN echo "target_platform: ${TARGETPLATFORM}"
|
RUN echo "target_platform: ${TARGETPLATFORM}"
|
||||||
|
|
||||||
|
ARG BRANCH
|
||||||
|
ARG BUILD_VERSION
|
||||||
|
ARG COMMIT
|
||||||
|
# note: BUILD_VERSION may be blank
|
||||||
|
|
||||||
|
ENV BRANCH=${BRANCH}
|
||||||
|
ENV BUILD_VERSION=${BUILD_VERSION}
|
||||||
|
ENV COMMIT=${COMMIT}
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
# install dependencies
|
# install dependencies
|
||||||
RUN <<_DEPS
|
RUN <<_DEPS
|
||||||
@@ -23,6 +32,7 @@ apt-get update -y
|
|||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
build-essential=12.9* \
|
build-essential=12.9* \
|
||||||
cmake=3.18.4* \
|
cmake=3.18.4* \
|
||||||
|
git=1:2.30.2* \
|
||||||
libavdevice-dev=7:4.3.* \
|
libavdevice-dev=7:4.3.* \
|
||||||
libboost-filesystem-dev=1.74.0* \
|
libboost-filesystem-dev=1.74.0* \
|
||||||
libboost-locale-dev=1.74.0* \
|
libboost-locale-dev=1.74.0* \
|
||||||
|
|||||||
@@ -12,6 +12,15 @@ FROM sunshine-base as sunshine-build
|
|||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
RUN echo "target_platform: ${TARGETPLATFORM}"
|
RUN echo "target_platform: ${TARGETPLATFORM}"
|
||||||
|
|
||||||
|
ARG BRANCH
|
||||||
|
ARG BUILD_VERSION
|
||||||
|
ARG COMMIT
|
||||||
|
# note: BUILD_VERSION may be blank
|
||||||
|
|
||||||
|
ENV BRANCH=${BRANCH}
|
||||||
|
ENV BUILD_VERSION=${BUILD_VERSION}
|
||||||
|
ENV COMMIT=${COMMIT}
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
# install dependencies
|
# install dependencies
|
||||||
# hadolint ignore=DL3041
|
# hadolint ignore=DL3041
|
||||||
@@ -25,6 +34,7 @@ dnf -y install \
|
|||||||
cmake-3.22.2* \
|
cmake-3.22.2* \
|
||||||
gcc-12.0.1* \
|
gcc-12.0.1* \
|
||||||
gcc-c++-12.0.1* \
|
gcc-c++-12.0.1* \
|
||||||
|
git-2.39.2* \
|
||||||
libcap-devel-2.48* \
|
libcap-devel-2.48* \
|
||||||
libcurl-devel-7.82.0* \
|
libcurl-devel-7.82.0* \
|
||||||
libdrm-devel-2.4.110* \
|
libdrm-devel-2.4.110* \
|
||||||
|
|||||||
@@ -12,6 +12,15 @@ FROM sunshine-base as sunshine-build
|
|||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
RUN echo "target_platform: ${TARGETPLATFORM}"
|
RUN echo "target_platform: ${TARGETPLATFORM}"
|
||||||
|
|
||||||
|
ARG BRANCH
|
||||||
|
ARG BUILD_VERSION
|
||||||
|
ARG COMMIT
|
||||||
|
# note: BUILD_VERSION may be blank
|
||||||
|
|
||||||
|
ENV BRANCH=${BRANCH}
|
||||||
|
ENV BUILD_VERSION=${BUILD_VERSION}
|
||||||
|
ENV COMMIT=${COMMIT}
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
# install dependencies
|
# install dependencies
|
||||||
# hadolint ignore=DL3041
|
# hadolint ignore=DL3041
|
||||||
@@ -25,6 +34,7 @@ dnf -y install \
|
|||||||
cmake-3.24.1* \
|
cmake-3.24.1* \
|
||||||
gcc-12.2.1* \
|
gcc-12.2.1* \
|
||||||
gcc-c++-12.2.1* \
|
gcc-c++-12.2.1* \
|
||||||
|
git-2.39.2* \
|
||||||
libcap-devel-2.48* \
|
libcap-devel-2.48* \
|
||||||
libcurl-devel-7.85.0* \
|
libcurl-devel-7.85.0* \
|
||||||
libdrm-devel-2.4.112* \
|
libdrm-devel-2.4.112* \
|
||||||
|
|||||||
@@ -14,6 +14,15 @@ FROM sunshine-base as sunshine-build
|
|||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
RUN echo "target_platform: ${TARGETPLATFORM}"
|
RUN echo "target_platform: ${TARGETPLATFORM}"
|
||||||
|
|
||||||
|
ARG BRANCH
|
||||||
|
ARG BUILD_VERSION
|
||||||
|
ARG COMMIT
|
||||||
|
# note: BUILD_VERSION may be blank
|
||||||
|
|
||||||
|
ENV BRANCH=${BRANCH}
|
||||||
|
ENV BUILD_VERSION=${BUILD_VERSION}
|
||||||
|
ENV COMMIT=${COMMIT}
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
# install dependencies
|
# install dependencies
|
||||||
RUN <<_DEPS
|
RUN <<_DEPS
|
||||||
@@ -24,6 +33,7 @@ apt-get install -y --no-install-recommends \
|
|||||||
build-essential=12.8* \
|
build-essential=12.8* \
|
||||||
gcc-10=10.3.0* \
|
gcc-10=10.3.0* \
|
||||||
g++-10=10.3.0* \
|
g++-10=10.3.0* \
|
||||||
|
git=1:2.25.1* \
|
||||||
libavdevice-dev=7:4.2.* \
|
libavdevice-dev=7:4.2.* \
|
||||||
libboost-filesystem-dev=1.71.0* \
|
libboost-filesystem-dev=1.71.0* \
|
||||||
libboost-locale-dev=1.71.0* \
|
libboost-locale-dev=1.71.0* \
|
||||||
|
|||||||
@@ -14,6 +14,15 @@ FROM sunshine-base as sunshine-build
|
|||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
RUN echo "target_platform: ${TARGETPLATFORM}"
|
RUN echo "target_platform: ${TARGETPLATFORM}"
|
||||||
|
|
||||||
|
ARG BRANCH
|
||||||
|
ARG BUILD_VERSION
|
||||||
|
ARG COMMIT
|
||||||
|
# note: BUILD_VERSION may be blank
|
||||||
|
|
||||||
|
ENV BRANCH=${BRANCH}
|
||||||
|
ENV BUILD_VERSION=${BUILD_VERSION}
|
||||||
|
ENV COMMIT=${COMMIT}
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
# install dependencies
|
# install dependencies
|
||||||
RUN <<_DEPS
|
RUN <<_DEPS
|
||||||
@@ -23,6 +32,7 @@ apt-get update -y
|
|||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
build-essential=12.9* \
|
build-essential=12.9* \
|
||||||
cmake=3.22.1* \
|
cmake=3.22.1* \
|
||||||
|
git=1:2.34.1* \
|
||||||
libavdevice-dev=7:4.4.* \
|
libavdevice-dev=7:4.4.* \
|
||||||
libboost-filesystem-dev=1.74.0* \
|
libboost-filesystem-dev=1.74.0* \
|
||||||
libboost-locale-dev=1.74.0* \
|
libboost-locale-dev=1.74.0* \
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include "rtsp.h"
|
#include "rtsp.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include "uuid.h"
|
#include "uuid.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
|
|
||||||
@@ -503,6 +504,7 @@ void getConfig(resp_https_t response, req_https_t request) {
|
|||||||
|
|
||||||
outputTree.put("status", "true");
|
outputTree.put("status", "true");
|
||||||
outputTree.put("platform", SUNSHINE_PLATFORM);
|
outputTree.put("platform", SUNSHINE_PLATFORM);
|
||||||
|
outputTree.put("version", PROJECT_VER);
|
||||||
outputTree.put("restart_supported", platf::restart_supported());
|
outputTree.put("restart_supported", platf::restart_supported());
|
||||||
|
|
||||||
auto vars = config::parse_config(read_file(config::sunshine.config_file.c_str()));
|
auto vars = config::parse_config(read_file(config::sunshine.config_file.c_str()));
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
return fn->second(argv[0], config::sunshine.cmd.argc, config::sunshine.cmd.argv);
|
return fn->second(argv[0], config::sunshine.cmd.argc, config::sunshine.cmd.argv);
|
||||||
}
|
}
|
||||||
|
BOOST_LOG(info) << PROJECT_NAME << " version: " << PROJECT_VER << std::endl;
|
||||||
task_pool.start(1);
|
task_pool.start(1);
|
||||||
|
|
||||||
// Create signal handler after logging has been initialized
|
// Create signal handler after logging has been initialized
|
||||||
|
|||||||
@@ -5,6 +5,6 @@
|
|||||||
#define PROJECT_VER "@PROJECT_VERSION@"
|
#define PROJECT_VER "@PROJECT_VERSION@"
|
||||||
#define PROJECT_VER_MAJOR "@PROJECT_VERSION_MAJOR@"
|
#define PROJECT_VER_MAJOR "@PROJECT_VERSION_MAJOR@"
|
||||||
#define PROJECT_VER_MINOR "@PROJECT_VERSION_MINOR@"
|
#define PROJECT_VER_MINOR "@PROJECT_VERSION_MINOR@"
|
||||||
#define PTOJECT_VER_PATCH "@PROJECT_VERSION_PATCH@"
|
#define PROJECT_VER_PATCH "@PROJECT_VERSION_PATCH@"
|
||||||
|
|
||||||
#endif // INCLUDE_GUARD
|
#endif // INCLUDE_GUARD
|
||||||
@@ -973,25 +973,27 @@
|
|||||||
this.restart_supported = (this.config.restart_supported === "true");
|
this.restart_supported = (this.config.restart_supported === "true");
|
||||||
|
|
||||||
var app = document.getElementById("app");
|
var app = document.getElementById("app");
|
||||||
if (this.platform == "windows") {
|
if (this.platform === "windows") {
|
||||||
this.tabs = this.tabs.filter((el) => {
|
this.tabs = this.tabs.filter((el) => {
|
||||||
return el.id !== "va-api" && el.id !== "vt";
|
return el.id !== "va-api" && el.id !== "vt";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.platform == "linux") {
|
if (this.platform === "linux") {
|
||||||
this.tabs = this.tabs.filter((el) => {
|
this.tabs = this.tabs.filter((el) => {
|
||||||
return el.id !== "amd" && el.id !== "qsv" && el.id !== "vt";
|
return el.id !== "amd" && el.id !== "qsv" && el.id !== "vt";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.platform == "macos") {
|
if (this.platform === "macos") {
|
||||||
this.tabs = this.tabs.filter((el) => {
|
this.tabs = this.tabs.filter((el) => {
|
||||||
return el.id !== "amd" && el.id !== "nv" && el.id !== "qsv" && el.id !== "va-api";
|
return el.id !== "amd" && el.id !== "nv" && el.id !== "qsv" && el.id !== "va-api";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
delete this.config.status;
|
// remove values we don't want in the config file
|
||||||
delete this.config.platform;
|
delete this.config.platform;
|
||||||
delete this.config.restart_supported;
|
delete this.config.restart_supported;
|
||||||
|
delete this.config.status;
|
||||||
|
delete this.config.version;
|
||||||
//Populate default values if not present in config
|
//Populate default values if not present in config
|
||||||
this.config.key_rightalt_to_key_win =
|
this.config.key_rightalt_to_key_win =
|
||||||
this.config.key_rightalt_to_key_win || "disabled";
|
this.config.key_rightalt_to_key_win || "disabled";
|
||||||
@@ -1057,7 +1059,7 @@
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(this.config),
|
body: JSON.stringify(this.config),
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
if (r.status == 200) this.saved = true;
|
if (r.status === 200) this.saved = true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
apply() {
|
apply() {
|
||||||
@@ -1067,11 +1069,11 @@
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify(this.config),
|
body: JSON.stringify(this.config),
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
if (r.status == 200) {
|
if (r.status === 200) {
|
||||||
fetch("/api/restart", {
|
fetch("/api/restart", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
}).then((r) => {
|
}).then((r) => {
|
||||||
if (r.status == 200) this.restarted = true;
|
if (r.status === 200) this.restarted = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,44 @@
|
|||||||
<div id="content" class="container">
|
<div id="content" class="container">
|
||||||
<h1 class="my-4">Hello, Sunshine!</h1>
|
<h1 class="my-4">Hello, Sunshine!</h1>
|
||||||
<p>Sunshine is a self-hosted game stream host for Moonlight.</p>
|
<p>Sunshine is a self-hosted game stream host for Moonlight.</p>
|
||||||
|
<!--Version-->
|
||||||
|
<div class="card p-2 my-4">
|
||||||
|
<div class="card-body" v-if="version">
|
||||||
|
<h2>Version {{version}}</h2>
|
||||||
|
<br />
|
||||||
|
<div class="alert alert-success" v-if="version.indexOf('dirty') !== -1">
|
||||||
|
Thank you for helping to make Sunshine a better software! 🌇
|
||||||
|
</div>
|
||||||
|
<div v-if="loading">
|
||||||
|
Loading Latest Release...
|
||||||
|
</div>
|
||||||
|
<div v-else-if="!hasNewNightly && !hasNewStable">
|
||||||
|
<div class="alert alert-success">
|
||||||
|
You're running the latest version of Sunshine
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="hasNewNightly">
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<div class="my-2">A new <b>Nightly</b> Version is Available!</div>
|
||||||
|
<a class="btn btn-success m-1" :href="nightlyData.html_url" target="_blank">Download</a>
|
||||||
|
</div>
|
||||||
|
<pre><b>{{nightlyData.head_sha}}</b></pre>
|
||||||
|
<pre>{{nightlyData.display_title}}</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="hasNewStable">
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<div class="my-2">A new <b>Stable</b> Version is Available!</div>
|
||||||
|
<a class="btn btn-success m-1" :href="githubVersion.html_url" target="_blank">Download</a>
|
||||||
|
</div>
|
||||||
|
<h3>{{githubVersion.name}}</h3>
|
||||||
|
<pre>{{githubVersion.body}}</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!--Resources-->
|
<!--Resources-->
|
||||||
<div class="card p-2 my-4">
|
<div class="card p-2 my-4">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -35,3 +73,55 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
new Vue({
|
||||||
|
el: "#content",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
version: null,
|
||||||
|
githubVersion: null,
|
||||||
|
nightlyData: null,
|
||||||
|
loading: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async created() {
|
||||||
|
try {
|
||||||
|
this.version = (await fetch("/api/config").then((r) => r.json())).version;
|
||||||
|
this.githubVersion = (await fetch("https://api.github.com/repos/LizardByte/Sunshine/releases/latest").then((r) => r.json()));
|
||||||
|
if (this.version.split("-g").length > 1) {
|
||||||
|
this.nightlyData = (await fetch("https://api.github.com/repos/LizardByte/Sunshine/actions/workflows/CI.yml/runs?branch=nightly&status=success&per_page=1").then((r) => r.json())).workflow_runs[0];
|
||||||
|
}
|
||||||
|
} catch(e){
|
||||||
|
}
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
// Check for new stable version
|
||||||
|
hasNewStable() {
|
||||||
|
// If we can't get versions, return false
|
||||||
|
if (!this.githubVersion || !this.version) return false;
|
||||||
|
// If built with dirty git tree, return false
|
||||||
|
if (this.version.indexOf("dirty") !== -1) return false;
|
||||||
|
// Get the GitHub version tag
|
||||||
|
let v = this.githubVersion.name;
|
||||||
|
// If the version starts with a v, remove it
|
||||||
|
if (v.indexOf("v") === 0) v = v.substring(1);
|
||||||
|
// return true if the version is different, otherwise false
|
||||||
|
return v !== this.version.split(".")[0];
|
||||||
|
},
|
||||||
|
// Check for new nightly version
|
||||||
|
hasNewNightly() {
|
||||||
|
// If we're not on a nightly build, just return false
|
||||||
|
// If length of version split is 3, we're on a stable build
|
||||||
|
if (!this.version || !this.nightlyData || this.version.split(".").length === 3) return false;
|
||||||
|
// If built with dirty git tree, return false
|
||||||
|
if (this.version.indexOf("dirty") !== -1) return false;
|
||||||
|
// Get the commit hash
|
||||||
|
let commit = this.version.split(".")[-1];
|
||||||
|
// return true if the commit hash is different, otherwise false
|
||||||
|
return this.nightlyData.head_sha.indexOf(commit) !== 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user