build(packaging): version number improvements (#4037)
This commit is contained in:
parent
5ef3f2ff5c
commit
2259141bd2
16 changed files with 104 additions and 69 deletions
12
.github/workflows/ci-flatpak.yml
vendored
12
.github/workflows/ci-flatpak.yml
vendored
|
|
@ -9,7 +9,7 @@ on:
|
||||||
release_commit:
|
release_commit:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
release_tag:
|
release_version:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
|
|
@ -104,6 +104,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
# variables for manifest
|
# variables for manifest
|
||||||
branch="${{ github.head_ref }}"
|
branch="${{ github.head_ref }}"
|
||||||
|
build_version=${{ inputs.release_version }}
|
||||||
commit=${{ inputs.release_commit }}
|
commit=${{ inputs.release_commit }}
|
||||||
|
|
||||||
# check the branch variable
|
# check the branch variable
|
||||||
|
|
@ -111,7 +112,6 @@ jobs:
|
||||||
then
|
then
|
||||||
echo "This is a PUSH event"
|
echo "This is a PUSH event"
|
||||||
branch=${{ github.ref_name }}
|
branch=${{ github.ref_name }}
|
||||||
build_version=${{ inputs.release_tag }}
|
|
||||||
clone_url=${{ github.event.repository.clone_url }}
|
clone_url=${{ github.event.repository.clone_url }}
|
||||||
else
|
else
|
||||||
echo "This is a PR event"
|
echo "This is a PR event"
|
||||||
|
|
@ -121,15 +121,17 @@ jobs:
|
||||||
echo "Commit: ${commit}"
|
echo "Commit: ${commit}"
|
||||||
echo "Clone URL: ${clone_url}"
|
echo "Clone URL: ${clone_url}"
|
||||||
|
|
||||||
|
export BRANCH=${branch}
|
||||||
|
export BUILD_VERSION=${build_version}
|
||||||
|
export CLONE_URL=${clone_url}
|
||||||
|
export COMMIT=${commit}
|
||||||
|
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
mkdir -p artifacts
|
mkdir -p artifacts
|
||||||
|
|
||||||
cmake -DGITHUB_CLONE_URL=${clone_url} \
|
cmake -DGITHUB_CLONE_URL=${clone_url} \
|
||||||
-B build \
|
-B build \
|
||||||
-S . \
|
-S . \
|
||||||
-DBUILD_VERSION=${build_version} \
|
|
||||||
-DGITHUB_BRANCH=${branch} \
|
|
||||||
-DGITHUB_COMMIT=${commit} \
|
|
||||||
-DSUNSHINE_CONFIGURE_FLATPAK_MAN=ON \
|
-DSUNSHINE_CONFIGURE_FLATPAK_MAN=ON \
|
||||||
-DSUNSHINE_CONFIGURE_ONLY=ON
|
-DSUNSHINE_CONFIGURE_ONLY=ON
|
||||||
|
|
||||||
|
|
|
||||||
18
.github/workflows/ci-homebrew.yml
vendored
18
.github/workflows/ci-homebrew.yml
vendored
|
|
@ -76,13 +76,13 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
# variables for formula
|
# variables for formula
|
||||||
branch="${{ github.head_ref }}"
|
branch="${{ github.head_ref }}"
|
||||||
|
build_version=${{ inputs.release_version }}
|
||||||
commit=${{ inputs.release_commit }}
|
commit=${{ inputs.release_commit }}
|
||||||
|
|
||||||
# check the branch variable
|
# check the branch variable
|
||||||
if [ -z "$branch" ]
|
if [ -z "$branch" ]
|
||||||
then
|
then
|
||||||
echo "This is a PUSH event"
|
echo "This is a PUSH event"
|
||||||
build_version=${{ inputs.release_tag }}
|
|
||||||
clone_url=${{ github.event.repository.clone_url }}
|
clone_url=${{ github.event.repository.clone_url }}
|
||||||
branch="${{ github.ref_name }}"
|
branch="${{ github.ref_name }}"
|
||||||
default_branch="${{ github.event.repository.default_branch }}"
|
default_branch="${{ github.event.repository.default_branch }}"
|
||||||
|
|
@ -90,35 +90,31 @@ jobs:
|
||||||
if [ "${{ matrix.release }}" == "true" ]; then
|
if [ "${{ matrix.release }}" == "true" ]; then
|
||||||
# we will publish the formula with the release tag
|
# we will publish the formula with the release tag
|
||||||
tag="${{ inputs.release_tag }}"
|
tag="${{ inputs.release_tag }}"
|
||||||
version="${{ inputs.release_version }}"
|
|
||||||
else
|
else
|
||||||
tag="${{ github.ref_name }}"
|
tag="${{ github.ref_name }}"
|
||||||
version="0.0.${{ github.run_number }}"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "This is a PR event"
|
echo "This is a PR event"
|
||||||
build_version="0.0.${{ github.event.number }}"
|
|
||||||
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
|
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
|
||||||
branch="${{ github.event.pull_request.head.ref }}"
|
branch="${{ github.event.pull_request.head.ref }}"
|
||||||
default_branch="${{ github.event.pull_request.head.repo.default_branch }}"
|
default_branch="${{ github.event.pull_request.head.repo.default_branch }}"
|
||||||
tag="${{ github.event.pull_request.head.ref }}"
|
tag="${{ github.event.pull_request.head.ref }}"
|
||||||
version="0.0.${{ github.event.number }}"
|
|
||||||
fi
|
fi
|
||||||
echo "Branch: ${branch}"
|
echo "Branch: ${branch}"
|
||||||
echo "Clone URL: ${clone_url}"
|
echo "Clone URL: ${clone_url}"
|
||||||
echo "Tag: ${tag}"
|
echo "Tag: ${tag}"
|
||||||
|
|
||||||
|
export BRANCH=${branch}
|
||||||
|
export BUILD_VERSION=${build_version}
|
||||||
|
export CLONE_URL=${clone_url}
|
||||||
|
export COMMIT=${commit}
|
||||||
|
export TAG=${tag}
|
||||||
|
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cmake \
|
cmake \
|
||||||
-B build \
|
-B build \
|
||||||
-S . \
|
-S . \
|
||||||
-DBUILD_VERSION="${build_version}" \
|
|
||||||
-DFORMULA_VERSION="${version}" \
|
|
||||||
-DGITHUB_BRANCH="${branch}" \
|
|
||||||
-DGITHUB_COMMIT="${commit}" \
|
|
||||||
-DGITHUB_CLONE_URL="${clone_url}" \
|
|
||||||
-DGITHUB_DEFAULT_BRANCH="${default_branch}" \
|
-DGITHUB_DEFAULT_BRANCH="${default_branch}" \
|
||||||
-DGITHUB_TAG="${tag}" \
|
|
||||||
-DSUNSHINE_CONFIGURE_HOMEBREW=ON \
|
-DSUNSHINE_CONFIGURE_HOMEBREW=ON \
|
||||||
-DSUNSHINE_CONFIGURE_ONLY=ON
|
-DSUNSHINE_CONFIGURE_ONLY=ON
|
||||||
|
|
||||||
|
|
|
||||||
6
.github/workflows/ci-linux.yml
vendored
6
.github/workflows/ci-linux.yml
vendored
|
|
@ -9,7 +9,7 @@ on:
|
||||||
release_commit:
|
release_commit:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
release_tag:
|
release_version:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ jobs:
|
||||||
- name: Build Linux
|
- name: Build Linux
|
||||||
env:
|
env:
|
||||||
BRANCH: ${{ github.head_ref || github.ref_name }}
|
BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||||
BUILD_VERSION: ${{ inputs.release_tag }}
|
BUILD_VERSION: ${{ inputs.release_version }}
|
||||||
COMMIT: ${{ inputs.release_commit }}
|
COMMIT: ${{ inputs.release_commit }}
|
||||||
run: |
|
run: |
|
||||||
chmod +x ./scripts/linux_build.sh
|
chmod +x ./scripts/linux_build.sh
|
||||||
|
|
@ -102,7 +102,7 @@ jobs:
|
||||||
- name: Set AppImage Version
|
- name: Set AppImage Version
|
||||||
if: matrix.name == 'AppImage'
|
if: matrix.name == 'AppImage'
|
||||||
run: |
|
run: |
|
||||||
version=${{ inputs.release_tag }}
|
version=${{ inputs.release_version }}
|
||||||
echo "VERSION=${version}" >> $GITHUB_ENV
|
echo "VERSION=${version}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Package Linux - AppImage
|
- name: Package Linux - AppImage
|
||||||
|
|
|
||||||
4
.github/workflows/ci-windows.yml
vendored
4
.github/workflows/ci-windows.yml
vendored
|
|
@ -9,7 +9,7 @@ on:
|
||||||
release_commit:
|
release_commit:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
release_tag:
|
release_version:
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
secrets:
|
secrets:
|
||||||
|
|
@ -257,7 +257,7 @@ jobs:
|
||||||
shell: msys2 {0}
|
shell: msys2 {0}
|
||||||
env:
|
env:
|
||||||
BRANCH: ${{ github.head_ref || github.ref_name }}
|
BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||||
BUILD_VERSION: ${{ inputs.release_tag }}
|
BUILD_VERSION: ${{ inputs.release_version }}
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
COMMIT: ${{ inputs.release_commit }}
|
COMMIT: ${{ inputs.release_commit }}
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
|
|
@ -59,6 +59,7 @@ jobs:
|
||||||
publish_release: ${{ needs.release-setup.outputs.publish_release }}
|
publish_release: ${{ needs.release-setup.outputs.publish_release }}
|
||||||
release_commit: ${{ needs.release-setup.outputs.release_commit }}
|
release_commit: ${{ needs.release-setup.outputs.release_commit }}
|
||||||
release_tag: ${{ needs.release-setup.outputs.release_tag }}
|
release_tag: ${{ needs.release-setup.outputs.release_tag }}
|
||||||
|
release_version: ${{ needs.release-setup.outputs.release_version }}
|
||||||
secrets:
|
secrets:
|
||||||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
|
||||||
|
|
@ -87,10 +88,11 @@ jobs:
|
||||||
uses: ./.github/workflows/ci-linux.yml
|
uses: ./.github/workflows/ci-linux.yml
|
||||||
with:
|
with:
|
||||||
release_commit: ${{ needs.release-setup.outputs.release_commit }}
|
release_commit: ${{ needs.release-setup.outputs.release_commit }}
|
||||||
release_tag: ${{ needs.release-setup.outputs.release_tag }}
|
release_version: ${{ needs.release-setup.outputs.release_version }}
|
||||||
|
|
||||||
build-linux-copr:
|
build-linux-copr:
|
||||||
name: Linux Copr
|
name: Linux Copr
|
||||||
|
if: github.event_name != 'push' # releases are handled directly in ci-copr.yml
|
||||||
needs: release-setup
|
needs: release-setup
|
||||||
uses: ./.github/workflows/ci-copr.yml
|
uses: ./.github/workflows/ci-copr.yml
|
||||||
secrets:
|
secrets:
|
||||||
|
|
@ -104,7 +106,7 @@ jobs:
|
||||||
uses: ./.github/workflows/ci-flatpak.yml
|
uses: ./.github/workflows/ci-flatpak.yml
|
||||||
with:
|
with:
|
||||||
release_commit: ${{ needs.release-setup.outputs.release_commit }}
|
release_commit: ${{ needs.release-setup.outputs.release_commit }}
|
||||||
release_tag: ${{ needs.release-setup.outputs.release_tag }}
|
release_version: ${{ needs.release-setup.outputs.release_version }}
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
name: Windows
|
name: Windows
|
||||||
|
|
@ -112,7 +114,7 @@ jobs:
|
||||||
uses: ./.github/workflows/ci-windows.yml
|
uses: ./.github/workflows/ci-windows.yml
|
||||||
with:
|
with:
|
||||||
release_commit: ${{ needs.release-setup.outputs.release_commit }}
|
release_commit: ${{ needs.release-setup.outputs.release_commit }}
|
||||||
release_tag: ${{ needs.release-setup.outputs.release_tag }}
|
release_version: ${{ needs.release-setup.outputs.release_version }}
|
||||||
secrets:
|
secrets:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,6 @@ include_directories(BEFORE SYSTEM "${CMAKE_SOURCE_DIR}/third-party/nv-codec-head
|
||||||
file(GLOB NVENC_SOURCES CONFIGURE_DEPENDS "src/nvenc/*.cpp" "src/nvenc/*.h")
|
file(GLOB NVENC_SOURCES CONFIGURE_DEPENDS "src/nvenc/*.cpp" "src/nvenc/*.h")
|
||||||
list(APPEND PLATFORM_TARGET_FILES ${NVENC_SOURCES})
|
list(APPEND PLATFORM_TARGET_FILES ${NVENC_SOURCES})
|
||||||
|
|
||||||
configure_file("${CMAKE_SOURCE_DIR}/src/version.h.in" version.h @ONLY)
|
|
||||||
include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") # required for importing version.h
|
|
||||||
|
|
||||||
set(SUNSHINE_TARGET_FILES
|
set(SUNSHINE_TARGET_FILES
|
||||||
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/Input.h"
|
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/Input.h"
|
||||||
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/Rtsp.h"
|
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/src/Rtsp.h"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@
|
||||||
# common cpack options
|
# common cpack options
|
||||||
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
|
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
|
||||||
set(CPACK_PACKAGE_VENDOR "LizardByte")
|
set(CPACK_PACKAGE_VENDOR "LizardByte")
|
||||||
string(REGEX REPLACE "^v" "" CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) # remove the v prefix if it exists
|
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
||||||
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cpack_artifacts)
|
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cpack_artifacts)
|
||||||
set(CPACK_PACKAGE_CONTACT "https://app.lizardbyte.dev")
|
set(CPACK_PACKAGE_CONTACT "https://app.lizardbyte.dev")
|
||||||
set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION})
|
set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION})
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,34 @@
|
||||||
|
# Set build variables if env variables are defined
|
||||||
|
# These are used in configured files such as manifests for different packages
|
||||||
|
if(DEFINED ENV{BRANCH}) # cmake-lint: disable=W0106
|
||||||
|
set(GITHUB_BRANCH $ENV{BRANCH})
|
||||||
|
endif()
|
||||||
|
if(DEFINED ENV{BUILD_VERSION}) # cmake-lint: disable=W0106
|
||||||
|
set(BUILD_VERSION $ENV{BUILD_VERSION})
|
||||||
|
endif()
|
||||||
|
if(DEFINED ENV{CLONE_URL}) # cmake-lint: disable=W0106
|
||||||
|
set(GITHUB_CLONE_URL $ENV{CLONE_URL})
|
||||||
|
endif()
|
||||||
|
if(DEFINED ENV{COMMIT}) # cmake-lint: disable=W0106
|
||||||
|
set(GITHUB_COMMIT $ENV{COMMIT})
|
||||||
|
endif()
|
||||||
|
if(DEFINED ENV{TAG}) # cmake-lint: disable=W0106
|
||||||
|
set(GITHUB_TAG $ENV{TAG})
|
||||||
|
endif()
|
||||||
|
|
||||||
# Check if env vars are defined before attempting to access them, variables will be defined even if blank
|
# 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((DEFINED ENV{BRANCH}) AND (DEFINED ENV{BUILD_VERSION})) # cmake-lint: disable=W0106
|
||||||
if(($ENV{BRANCH} STREQUAL "master") AND (NOT $ENV{BUILD_VERSION} STREQUAL ""))
|
if((DEFINED ENV{BRANCH}) AND (NOT $ENV{BUILD_VERSION} STREQUAL ""))
|
||||||
# If BRANCH is "master" and BUILD_VERSION is not empty, then we are building a master branch
|
# If BRANCH is defined and BUILD_VERSION is not empty, then we are building from CI
|
||||||
MESSAGE("Got from CI master branch and version $ENV{BUILD_VERSION}")
|
# If BRANCH is master we are building a push/release build
|
||||||
|
MESSAGE("Got from CI '$ENV{BRANCH}' branch and version '$ENV{BUILD_VERSION}'")
|
||||||
set(PROJECT_VERSION $ENV{BUILD_VERSION})
|
set(PROJECT_VERSION $ENV{BUILD_VERSION})
|
||||||
|
string(REGEX REPLACE "^v" "" PROJECT_VERSION ${PROJECT_VERSION}) # remove the v prefix if it exists
|
||||||
set(CMAKE_PROJECT_VERSION ${PROJECT_VERSION}) # cpack will use this to set the binary versions
|
set(CMAKE_PROJECT_VERSION ${PROJECT_VERSION}) # cpack will use this to set the binary versions
|
||||||
elseif((DEFINED ENV{BRANCH}) AND (DEFINED ENV{COMMIT}))
|
|
||||||
# If BRANCH is set but not BUILD_VERSION we are building a PR, 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()
|
endif()
|
||||||
|
else()
|
||||||
# Generate Sunshine Version based of the git tag
|
# Generate Sunshine Version based of the git tag
|
||||||
# https://github.com/nocnokneo/cmake-git-versioning-example/blob/master/LICENSE
|
# https://github.com/nocnokneo/cmake-git-versioning-example/blob/master/LICENSE
|
||||||
else()
|
|
||||||
find_package(Git)
|
find_package(Git)
|
||||||
if(GIT_EXECUTABLE)
|
if(GIT_EXECUTABLE)
|
||||||
MESSAGE("${CMAKE_SOURCE_DIR}")
|
MESSAGE("${CMAKE_SOURCE_DIR}")
|
||||||
|
|
@ -60,18 +76,24 @@ set(PROJECT_YEAR "1990")
|
||||||
set(PROJECT_MONTH "01")
|
set(PROJECT_MONTH "01")
|
||||||
set(PROJECT_DAY "01")
|
set(PROJECT_DAY "01")
|
||||||
|
|
||||||
# Extract year, month, and day
|
# Extract year, month, and day (do this AFTER version parsing)
|
||||||
if(PROJECT_VERSION MATCHES "^([0-9]{4})[.]([0-9]{3,4})")
|
# Note: Cmake doesn't support "{}" regex syntax
|
||||||
|
if(PROJECT_VERSION MATCHES "^([0-9][0-9][0-9][0-9])\\.([0-9][0-9][0-9][0-9]?)\\.([0-9]+)$")
|
||||||
|
message("Extracting year and month/day from PROJECT_VERSION: ${PROJECT_VERSION}")
|
||||||
# First capture group is the year
|
# First capture group is the year
|
||||||
set(PROJECT_YEAR "${CMAKE_MATCH_1}")
|
set(PROJECT_YEAR "${CMAKE_MATCH_1}")
|
||||||
|
|
||||||
# Second capture group is month/day
|
# Second capture group contains month and day
|
||||||
set(MONTH_DAY "${CMAKE_MATCH_2}")
|
set(MONTH_DAY "${CMAKE_MATCH_2}")
|
||||||
|
|
||||||
|
# Extract month (first 1-2 digits) and day (last 2 digits)
|
||||||
string(LENGTH "${MONTH_DAY}" MONTH_DAY_LENGTH)
|
string(LENGTH "${MONTH_DAY}" MONTH_DAY_LENGTH)
|
||||||
if(MONTH_DAY_LENGTH EQUAL 3)
|
if(MONTH_DAY_LENGTH EQUAL 3)
|
||||||
|
# Format: MDD (e.g., 703 = month 7, day 03)
|
||||||
string(SUBSTRING "${MONTH_DAY}" 0 1 PROJECT_MONTH)
|
string(SUBSTRING "${MONTH_DAY}" 0 1 PROJECT_MONTH)
|
||||||
string(SUBSTRING "${MONTH_DAY}" 1 2 PROJECT_DAY)
|
string(SUBSTRING "${MONTH_DAY}" 1 2 PROJECT_DAY)
|
||||||
elseif(MONTH_DAY_LENGTH EQUAL 4)
|
elseif(MONTH_DAY_LENGTH EQUAL 4)
|
||||||
|
# Format: MMDD (e.g., 1203 = month 12, day 03)
|
||||||
string(SUBSTRING "${MONTH_DAY}" 0 2 PROJECT_MONTH)
|
string(SUBSTRING "${MONTH_DAY}" 0 2 PROJECT_MONTH)
|
||||||
string(SUBSTRING "${MONTH_DAY}" 2 2 PROJECT_DAY)
|
string(SUBSTRING "${MONTH_DAY}" 2 2 PROJECT_DAY)
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -85,3 +107,35 @@ if(PROJECT_VERSION MATCHES "^([0-9]{4})[.]([0-9]{3,4})")
|
||||||
set(PROJECT_DAY "0${PROJECT_DAY}")
|
set(PROJECT_DAY "0${PROJECT_DAY}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Parse PROJECT_VERSION to extract major, minor, and patch components
|
||||||
|
if(PROJECT_VERSION MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)")
|
||||||
|
set(PROJECT_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||||
|
set(CMAKE_PROJECT_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||||
|
|
||||||
|
set(PROJECT_VERSION_MINOR "${CMAKE_MATCH_2}")
|
||||||
|
set(CMAKE_PROJECT_VERSION_MINOR "${CMAKE_MATCH_2}")
|
||||||
|
|
||||||
|
set(PROJECT_VERSION_PATCH "${CMAKE_MATCH_3}")
|
||||||
|
set(CMAKE_PROJECT_VERSION_PATCH "${CMAKE_MATCH_3}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message("PROJECT_NAME: ${PROJECT_NAME}")
|
||||||
|
message("PROJECT_VERSION: ${PROJECT_VERSION}")
|
||||||
|
message("PROJECT_VERSION_MAJOR: ${PROJECT_VERSION_MAJOR}")
|
||||||
|
message("PROJECT_VERSION_MINOR: ${PROJECT_VERSION_MINOR}")
|
||||||
|
message("PROJECT_VERSION_PATCH: ${PROJECT_VERSION_PATCH}")
|
||||||
|
message("CMAKE_PROJECT_VERSION: ${CMAKE_PROJECT_VERSION}")
|
||||||
|
message("CMAKE_PROJECT_VERSION_MAJOR: ${CMAKE_PROJECT_VERSION_MAJOR}")
|
||||||
|
message("CMAKE_PROJECT_VERSION_MINOR: ${CMAKE_PROJECT_VERSION_MINOR}")
|
||||||
|
message("CMAKE_PROJECT_VERSION_PATCH: ${CMAKE_PROJECT_VERSION_PATCH}")
|
||||||
|
message("PROJECT_YEAR: ${PROJECT_YEAR}")
|
||||||
|
message("PROJECT_MONTH: ${PROJECT_MONTH}")
|
||||||
|
message("PROJECT_DAY: ${PROJECT_DAY}")
|
||||||
|
|
||||||
|
list(APPEND SUNSHINE_DEFINITIONS PROJECT_NAME="${PROJECT_NAME}")
|
||||||
|
list(APPEND SUNSHINE_DEFINITIONS PROJECT_VERSION="${PROJECT_VERSION}")
|
||||||
|
list(APPEND SUNSHINE_DEFINITIONS PROJECT_VERSION_MAJOR="${PROJECT_VERSION_MAJOR}")
|
||||||
|
list(APPEND SUNSHINE_DEFINITIONS PROJECT_VERSION_MINOR="${PROJECT_VERSION_MINOR}")
|
||||||
|
list(APPEND SUNSHINE_DEFINITIONS PROJECT_VERSION_PATCH="${PROJECT_VERSION_PATCH}")
|
||||||
|
list(APPEND SUNSHINE_DEFINITIONS PROJECT_VERSION_COMMIT="${GITHUB_COMMIT}")
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ ARG CLONE_URL
|
||||||
ENV BRANCH=${BRANCH}
|
ENV BRANCH=${BRANCH}
|
||||||
ENV BUILD_VERSION=${BUILD_VERSION}
|
ENV BUILD_VERSION=${BUILD_VERSION}
|
||||||
ENV COMMIT=${COMMIT}
|
ENV COMMIT=${COMMIT}
|
||||||
|
ENV CLONE_URL=${CLONE_URL}
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
|
|
@ -68,19 +69,16 @@ WORKDIR /build/sunshine/build
|
||||||
RUN <<_MAKE
|
RUN <<_MAKE
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
if [[ "${BUILD_VERSION}" == '' ]]; then
|
|
||||||
|
sub_version=""
|
||||||
|
if [[ "${BRANCH}" != "master" ]]; then
|
||||||
sub_version=".r${COMMIT}"
|
sub_version=".r${COMMIT}"
|
||||||
else
|
|
||||||
sub_version=""
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmake \
|
cmake \
|
||||||
|
-DSUNSHINE_CONFIGURE_ONLY=ON \
|
||||||
-DSUNSHINE_CONFIGURE_PKGBUILD=ON \
|
-DSUNSHINE_CONFIGURE_PKGBUILD=ON \
|
||||||
-DSUNSHINE_SUB_VERSION="${sub_version}" \
|
-DSUNSHINE_SUB_VERSION="${sub_version}" \
|
||||||
-DGITHUB_CLONE_URL="${CLONE_URL}" \
|
|
||||||
-DGITHUB_BRANCH=${BRANCH} \
|
|
||||||
-DGITHUB_BUILD_VERSION=${BUILD_VERSION} \
|
|
||||||
-DGITHUB_COMMIT="${COMMIT}" \
|
|
||||||
-DSUNSHINE_CONFIGURE_ONLY=ON \
|
|
||||||
/build/sunshine
|
/build/sunshine
|
||||||
_MAKE
|
_MAKE
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ prepare() {
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
export BRANCH="@GITHUB_BRANCH@"
|
export BRANCH="@GITHUB_BRANCH@"
|
||||||
export BUILD_VERSION="@GITHUB_BUILD_VERSION@"
|
export BUILD_VERSION="@BUILD_VERSION@"
|
||||||
export COMMIT="@GITHUB_COMMIT@"
|
export COMMIT="@GITHUB_COMMIT@"
|
||||||
|
|
||||||
export CC="gcc-${_gcc_version}"
|
export CC="gcc-${_gcc_version}"
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ class @PROJECT_NAME@ < Formula
|
||||||
homepage "@PROJECT_HOMEPAGE_URL@"
|
homepage "@PROJECT_HOMEPAGE_URL@"
|
||||||
url "@GITHUB_CLONE_URL@",
|
url "@GITHUB_CLONE_URL@",
|
||||||
tag: "@GITHUB_TAG@"
|
tag: "@GITHUB_TAG@"
|
||||||
version "@FORMULA_VERSION@"
|
version "@BUILD_VERSION@"
|
||||||
license all_of: ["GPL-3.0-only"]
|
license all_of: ["GPL-3.0-only"]
|
||||||
head "@GITHUB_CLONE_URL@", branch: "@GITHUB_DEFAULT_BRANCH@"
|
head "@GITHUB_CLONE_URL@", branch: "@GITHUB_DEFAULT_BRANCH@"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include "uuid.h"
|
#include "uuid.h"
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
|
|
||||||
|
|
@ -843,7 +842,7 @@ namespace confighttp {
|
||||||
nlohmann::json output_tree;
|
nlohmann::json output_tree;
|
||||||
output_tree["status"] = true;
|
output_tree["status"] = true;
|
||||||
output_tree["platform"] = SUNSHINE_PLATFORM;
|
output_tree["platform"] = SUNSHINE_PLATFORM;
|
||||||
output_tree["version"] = PROJECT_VER;
|
output_tree["version"] = PROJECT_VERSION;
|
||||||
|
|
||||||
auto vars = config::parse_config(file_handler::read_file(config::sunshine.config_file.c_str()));
|
auto vars = config::parse_config(file_handler::read_file(config::sunshine.config_file.c_str()));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "platform/common.h"
|
#include "platform/common.h"
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
#include "system_tray.h"
|
#include "system_tray.h"
|
||||||
#include "upnp.h"
|
#include "upnp.h"
|
||||||
#include "version.h"
|
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
@ -123,7 +122,7 @@ int main(int argc, char *argv[]) {
|
||||||
// logging can begin at this point
|
// logging can begin at this point
|
||||||
// if anything is logged prior to this point, it will appear in stdout, but not in the log viewer in the UI
|
// if anything is logged prior to this point, it will appear in stdout, but not in the log viewer in the UI
|
||||||
// the version should be printed to the log before anything else
|
// the version should be printed to the log before anything else
|
||||||
BOOST_LOG(info) << PROJECT_NAME << " version: " << PROJECT_VER;
|
BOOST_LOG(info) << PROJECT_NAME << " version: " << PROJECT_VERSION << " commit: " << PROJECT_VERSION_COMMIT;
|
||||||
|
|
||||||
// Log publisher metadata
|
// Log publisher metadata
|
||||||
log_publisher_data();
|
log_publisher_data();
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@
|
||||||
#include "platform/common.h"
|
#include "platform/common.h"
|
||||||
#include "process.h"
|
#include "process.h"
|
||||||
#include "src/entry_handler.h"
|
#include "src/entry_handler.h"
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
/**
|
|
||||||
* @file src/version.h.in
|
|
||||||
* @brief Version definitions for Sunshine.
|
|
||||||
* @note The final `version.h` is generated from this file during the CMake build.
|
|
||||||
* @todo Use CMake definitions directly, instead of configuring this file.
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#define PROJECT_NAME "@PROJECT_NAME@"
|
|
||||||
#define PROJECT_VER "@PROJECT_VERSION@"
|
|
||||||
#define PROJECT_VER_MAJOR "@PROJECT_VERSION_MAJOR@"
|
|
||||||
#define PROJECT_VER_MINOR "@PROJECT_VERSION_MINOR@"
|
|
||||||
#define PROJECT_VER_PATCH "@PROJECT_VERSION_PATCH@"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue