From cc981a1bbfe0689cf1d6a86e0bd274b1f0b5230d Mon Sep 17 00:00:00 2001 From: williamhCode Date: Sun, 22 Dec 2024 10:13:48 +0800 Subject: [PATCH] update night github actino --- .github/workflows/build.yml | 31 ++++++------------------------- CmakeLists.txt | 24 ++++++++++++++++++++---- src/nvim/nvim.cpp | 8 +++++--- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 774df31..3630c19 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,6 +53,7 @@ jobs: -DSDL_SHARED=OFF -DSDL_STATIC=ON -DBLEND2D_STATIC=ON + $([[ "${{ github.event.inputs.nightly }}" == "true" ]] && echo "-DDEV_BUILD=ON" || echo "") - name: Build neogurt run: cmake --build build/release --target neogurt @@ -60,13 +61,6 @@ jobs: - name: Generate package run: make package - - name: Rename DMG for nightly - if: ${{ github.event.inputs.nightly == 'true' }} - run: | - cd build/release - COMMIT_HASH=$(git rev-parse --short HEAD) - mv Neogurt*.dmg Neogurt-${COMMIT_HASH}.dmg - - name: Prepare artifacts run: | cd build/release @@ -78,19 +72,6 @@ jobs: name: ${{ env.ARTIFACT_NAME }} path: build/release/${{ env.ARTIFACT_NAME }} - # - name: Create release for nightly - # if: ${{ github.event.inputs.nightly == 'true' }} - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # run: | - # TAG_NAME="nightly-$(date +%Y-%m-%d)" - # RELEASE_NAME="Nightly Build $(date +%Y-%m-%d)" - # FILE_PATH="build/release/${{ env.ARTIFACT_NAME }}" - # gh release create $TAG_NAME $FILE_PATH \ - # --title "$RELEASE_NAME" \ - # --notes "Nightly build for commit ${{ github.sha }}" \ - # --prerelease - create-release: if: ${{ github.event.inputs.nightly == 'true' }} needs: build @@ -107,9 +88,9 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - TAG_NAME="nightly-$(date +'%Y-%m-%d')" - RELEASE_NAME="Nightly Build $(date +'%Y-%m-%d')" - gh release create $TAG_NAME artifacts/* \ - --title "$RELEASE_NAME" \ - --notes "Nightly build for commit ${{ github.sha }}" \ + gh release delete nightly --yes || true + git push origin :nightly || true + gh release create nightly artifacts/* \ + --title "Neogurt dev build" \ + --notes "Dev build for commit ${{ github.sha }}" \ --prerelease diff --git a/CmakeLists.txt b/CmakeLists.txt index 52f7ca3..c449832 100644 --- a/CmakeLists.txt +++ b/CmakeLists.txt @@ -4,11 +4,24 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum OS X deployment ver project( Neogurt - VERSION 0.1.4 + VERSION 0.1.5 DESCRIPTION "A Neovim GUI Smooth like Yogurt!" LANGUAGES C CXX ) +if (DEV_BUILD) + execute_process( + COMMAND git rev-parse --short HEAD + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + set(PROJECT_VERSION_SUFFIX "dev") + set(PROJECT_VERSION_COMMIT ${GIT_COMMIT_HASH}) + set(PROJECT_VERSION "${PROJECT_VERSION}-${PROJECT_VERSION_SUFFIX}-${PROJECT_VERSION_COMMIT}") +endif() + # fix https://gitlab.kitware.com/cmake/cmake/-/issues/24104 enable_language(OBJC) @@ -87,9 +100,12 @@ add_executable(neogurt ${APP_SRC}) target_compile_definitions(neogurt PRIVATE VERSION="${PROJECT_VERSION}" - MAJOR_VERSION="${PROJECT_VERSION_MAJOR}" - MINOR_VERSION="${PROJECT_VERSION_MINOR}" - PATCH_VERSION="${PROJECT_VERSION_PATCH}" + VERSION_MAJOR="${PROJECT_VERSION_MAJOR}" + VERSION_MINOR="${PROJECT_VERSION_MINOR}" + VERSION_PATCH="${PROJECT_VERSION_PATCH}" + VERSION_SUFFIX="${PROJECT_VERSION_SUFFIX}" + VERSION_COMMIT="${PROJECT_VERSION_COMMIT}" + ROOT_DIR="${PROJECT_SOURCE_DIR}" ) diff --git a/src/nvim/nvim.cpp b/src/nvim/nvim.cpp index 02c2ad1..616bfc9 100644 --- a/src/nvim/nvim.cpp +++ b/src/nvim/nvim.cpp @@ -56,9 +56,11 @@ void Nvim::Setup() { SetClientInfo( "neogurt", { - {"major", MAJOR_VERSION}, - {"minor", MINOR_VERSION}, - {"patch", PATCH_VERSION}, + {"major", VERSION_MAJOR}, + {"minor", VERSION_MINOR}, + {"patch", VERSION_PATCH}, + {"prerelease", VERSION_SUFFIX}, + {"commit", VERSION_COMMIT}, }, "ui", {}, {} )