Skip to content

Commit 70a621b

Browse files
Merge pull request #17 from IABTechLab/ant-UID2-1279-release-workflow
Add basic versioning and manual release workflow
2 parents cc3a83a + 5e3bd04 commit 70a621b

File tree

6 files changed

+48
-7
lines changed

6 files changed

+48
-7
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Release
2+
3+
on: [workflow_dispatch]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-22.04
8+
steps:
9+
- uses: actions/checkout@v3
10+
11+
- name: Dev environment
12+
run: |
13+
sudo ${{github.workspace}}/tools/install-ubuntu-devtools.sh
14+
sudo ${{github.workspace}}/tools/install-ubuntu-deps.sh
15+
16+
- name: Run cmake
17+
run: |
18+
mkdir build
19+
cd build
20+
cmake ..
21+
22+
- name: Create and push tag
23+
run: |
24+
TAG_NAME=v$(cat build/VERSION)
25+
git config user.name "${GITHUB_ACTOR}"
26+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
27+
git tag -a "${TAG_NAME}" -m "Release ${TAG_NAME}"
28+
git push origin "${TAG_NAME}"

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
cmake_minimum_required (VERSION 3.12)
22

3-
project ("uid2-client")
3+
project ("uid2-client" VERSION 3.0.0)
4+
5+
configure_file(VERSION.in VERSION @ONLY)
46

57
set (CMAKE_CXX_STANDARD 11)
68

VERSION.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@PROJECT_VERSION@

lib/CMakeLists.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
add_compile_definitions(CPPHTTPLIB_OPENSSL_SUPPORT)
22

33
find_package(OpenSSL REQUIRED)
4-
message( ${OPENSSL_INCLUDE_DIR} )
5-
message( ${OPENSSL_LIBRARIES} )
6-
74
find_package(Threads REQUIRED)
85

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

15-
add_library(uid2client ${UID2_PUBLIC_HEADERS} ${UID2_HEADERS} ${UID2_SOURCES} ${EXTERNAL_HEADERS} ${EXTERNAL_SOURCES})
12+
configure_file(version.h.in version.h @ONLY)
13+
14+
add_library(uid2client
15+
${UID2_PUBLIC_HEADERS}
16+
${UID2_HEADERS}
17+
${UID2_SOURCES}
18+
${EXTERNAL_HEADERS}
19+
${EXTERNAL_SOURCES}
20+
${CMAKE_CURRENT_BINARY_DIR}/version.h)
1621

1722
target_include_directories(uid2client SYSTEM
1823
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external
1924
PRIVATE ${OPENSSL_INCLUDE_DIR})
2025
target_include_directories(uid2client
21-
PUBLIC ../include)
26+
PUBLIC ../include
27+
PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
2228
target_compile_features(uid2client PUBLIC cxx_std_11)
2329

2430
if(THREADS_HAVE_PTHREAD_ARG)

lib/uid2client.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "keycontainer.h"
55
#include "keyparser.h"
66
#include "uid2encryption.h"
7+
#include "version.h"
78

89
#include <uid2/uid2client.h>
910

@@ -30,7 +31,7 @@ struct UID2Client::Impl {
3031
// TODO: non-https endpoint warning
3132
}
3233

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

3637
~Impl();

lib/version.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
#define UID2_SDK_VERSION "@PROJECT_VERSION@"

0 commit comments

Comments
 (0)