Skip to content

Commit

Permalink
Merge pull request #17 from IABTechLab/ant-UID2-1279-release-workflow
Browse files Browse the repository at this point in the history
Add basic versioning and manual release workflow
  • Loading branch information
atarassov-ttd authored Jun 6, 2023
2 parents cc3a83a + 5e3bd04 commit 70a621b
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 7 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release

on: [workflow_dispatch]

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

- name: Dev environment
run: |
sudo ${{github.workspace}}/tools/install-ubuntu-devtools.sh
sudo ${{github.workspace}}/tools/install-ubuntu-deps.sh
- name: Run cmake
run: |
mkdir build
cd build
cmake ..
- name: Create and push tag
run: |
TAG_NAME=v$(cat build/VERSION)
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a "${TAG_NAME}" -m "Release ${TAG_NAME}"
git push origin "${TAG_NAME}"
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required (VERSION 3.12)

project ("uid2-client")
project ("uid2-client" VERSION 3.0.0)

configure_file(VERSION.in VERSION @ONLY)

set (CMAKE_CXX_STANDARD 11)

Expand Down
1 change: 1 addition & 0 deletions VERSION.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@PROJECT_VERSION@
16 changes: 11 additions & 5 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
add_compile_definitions(CPPHTTPLIB_OPENSSL_SUPPORT)

find_package(OpenSSL REQUIRED)
message( ${OPENSSL_INCLUDE_DIR} )
message( ${OPENSSL_LIBRARIES} )

find_package(Threads REQUIRED)

file(GLOB UID2_PUBLIC_HEADERS CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/include/uid2/*.h")
Expand All @@ -12,13 +9,22 @@ file(GLOB UID2_SOURCES CONFIGURE_DEPENDS "*.cpp")
file(GLOB EXTERNAL_HEADERS CONFIGURE_DEPENDS "external/*.h*")
file(GLOB EXTERNAL_SOURCES CONFIGURE_DEPENDS "external/*.cpp")

add_library(uid2client ${UID2_PUBLIC_HEADERS} ${UID2_HEADERS} ${UID2_SOURCES} ${EXTERNAL_HEADERS} ${EXTERNAL_SOURCES})
configure_file(version.h.in version.h @ONLY)

add_library(uid2client
${UID2_PUBLIC_HEADERS}
${UID2_HEADERS}
${UID2_SOURCES}
${EXTERNAL_HEADERS}
${EXTERNAL_SOURCES}
${CMAKE_CURRENT_BINARY_DIR}/version.h)

target_include_directories(uid2client SYSTEM
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external
PRIVATE ${OPENSSL_INCLUDE_DIR})
target_include_directories(uid2client
PUBLIC ../include)
PUBLIC ../include
PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_compile_features(uid2client PUBLIC cxx_std_11)

if(THREADS_HAVE_PTHREAD_ARG)
Expand Down
3 changes: 2 additions & 1 deletion lib/uid2client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "keycontainer.h"
#include "keyparser.h"
#include "uid2encryption.h"
#include "version.h"

#include <uid2/uid2client.h>

Expand All @@ -30,7 +31,7 @@ struct UID2Client::Impl {
// TODO: non-https endpoint warning
}

httpClient_.set_default_headers({{"Authorization", "Bearer " + authKey_}, {"X-UID2-Client-Version", "uid2-client-c++_2.0.0"}});
httpClient_.set_default_headers({{"Authorization", "Bearer " + authKey_}, {"X-UID2-Client-Version", "uid2-client-c++_" UID2_SDK_VERSION}});
}

~Impl();
Expand Down
3 changes: 3 additions & 0 deletions lib/version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

#define UID2_SDK_VERSION "@PROJECT_VERSION@"

0 comments on commit 70a621b

Please sign in to comment.