Skip to content

Fix version string management #8

Fix version string management

Fix version string management #8

# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: CMake Ubuntu-latest
on:
push:
tags: [ "[0-9]+.[0-9]+.[0-9]+*" ]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
CXX: g++-11
C: gcc-11
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDIPLOMAT_VERSION=${{ github.ref_name }}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target slang-lsp -j `nproc`
- name: Check versions
run: |
echo "Placed tag is ${{ github.ref_name }}. Server version is `${{github.workspace}}/build/slang-lsp --version`."
'[[ "${{ github.ref_name }}" == `${{github.workspace}}/build/slang-lsp --version` ]]'
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ success() }}
with:
name: slang-lsp-${{ github.ref_name }}
path: ${{github.workspace}}/build/slang-lsp
overwrite: true
if-no-files-found: error
# Is a binary
compression-level: 0
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Process release version
id: semver
uses: madhead/semver-utils@latest
with:
version: ${{ github.ref_name }}
lenient: false
- name: Extract changelog
run: |
head -n $((`grep -n -m 2 '^# ' ${{github.workspace}}/CHANGELOG.md | sed 's/:.\+//g' | tail -n 1`-1)) ${{github.workspace}}/CHANGELOG.md > ${{github.workspace}}RELNOTES.md
cat ${{github.workspace}}/RELNOTES.md
- name: Retrieve artifact
if: ${{ success() }}
uses: actions/download-artifact@v4
with:
name: slang-lsp-${{ github.ref_name }}
- name: Create main release from tag
if: ${{ success() && steps.semver.outputs.build-parts == '0' }}
uses: softprops/action-gh-release@v2
with:
body_path: ${{github.workspace}}/RELNOTES.md
make_latest: true
prerelease: false
files: |
slang-lsp-${{ github.ref_name }}
- name: Create dev release from tag
if: ${{ success() && steps.semver.outputs.build-parts != '0' }}
uses: softprops/action-gh-release@v2
with:
body_path: ${{github.workspace}}/RELNOTES.md
make_latest: false
prerelease: true
name: "Latest Dev Release"
files: |
slang-lsp-${{ github.ref_name }}
- name: Update latest branch
if: ${{ success() }}
uses: EndBug/latest-tag@latest
with:
# You can change the name of the tag or branch with this input.
# Default: 'latest'
# ref: someCustomTagName
# If a description is provided, the action will use it to create an annotated tag. If none is given, the action will create a lightweight tag.
# Default: ''
# description: Description for the tag
# Force-update a branch instead of using a tag.
# Default: false
force-branch: true
# - name: Test
# working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# run: ctest -C ${{env.BUILD_TYPE}}