Skip to content

Commit e888532

Browse files
GRISHNOVTotktonada
authored andcommitted
api: add hardcoded versioning support
Added the _VERSION variable to the exported table. Is part of the task [1]. 1. github.com/tarantool/roadmap-internal/issues/204
1 parent 63e9f00 commit e888532

File tree

5 files changed

+38
-2
lines changed

5 files changed

+38
-2
lines changed

.github/workflows/packaging.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,29 @@ name: packaging
33
on: [push, pull_request]
44

55
jobs:
6+
# Run not only on tags, otherwise dependent job will skip.
7+
version-check:
8+
# Skip pull request job when the source branch is in the same
9+
# repository.
10+
if: |
11+
github.event_name == 'push' ||
12+
github.event.pull_request.head.repo.full_name != github.repository
13+
runs-on: ubuntu-20.04
14+
steps:
15+
- name: Check module version
16+
# We need this step to run only on push with tag.
17+
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
18+
uses: tarantool/actions/check-module-version@master
19+
with:
20+
module-name: 'smtp'
21+
622
build_package:
723
# Skip pull request jobs when the source branch is in the same
824
# repository.
925
if: |
1026
github.event_name == 'push' ||
1127
github.event.pull_request.head.repo.full_name != github.repository
28+
needs: version-check
1229

1330
strategy:
1431
fail-fast: false

.github/workflows/publish.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ on:
66
tags: ['*']
77

88
jobs:
9+
version-check:
10+
# We need this job to run only on push with tag.
11+
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
12+
runs-on: ubuntu-20.04
13+
steps:
14+
- name: Check module version
15+
uses: tarantool/actions/check-module-version@master
16+
with:
17+
module-name: 'smtp'
18+
919
publish-scm-1:
1020
if: github.ref == 'refs/heads/master'
1121
runs-on: ubuntu-latest
@@ -18,6 +28,7 @@ jobs:
1828

1929
publish-tag:
2030
if: startsWith(github.ref, 'refs/tags/')
31+
needs: version-check
2132
runs-on: ubuntu-latest
2233
steps:
2334
- uses: actions/checkout@v3

smtp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,5 @@ target_link_libraries(lib ${CMAKE_DL_LIBS})
104104
set_target_properties(lib PROPERTIES PREFIX "" OUTPUT_NAME "lib")
105105

106106
# Install module
107-
install(FILES init.lua DESTINATION ${TARANTOOL_INSTALL_LUADIR}/${PROJECT_NAME}/)
107+
install(FILES init.lua version.lua DESTINATION ${TARANTOOL_INSTALL_LUADIR}/${PROJECT_NAME}/)
108108
install(TARGETS lib LIBRARY DESTINATION ${TARANTOOL_INSTALL_LIBDIR}/${PROJECT_NAME}/)

smtp/init.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,11 @@ curl_mt = {
277277
--
278278
-- Export
279279
--
280-
local this_module = { new = smtp_new, _CURL_VERSION = driver._CURL_VERSION }
280+
local this_module = {
281+
new = smtp_new,
282+
_CURL_VERSION = driver._CURL_VERSION,
283+
_VERSION = require('smtp.version'),
284+
}
281285

282286
package.loaded['smtp.client'] = this_module
283287
return this_module

smtp/version.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- Сontains the module version.
2+
-- Requires manual update in case of release commit.
3+
4+
return '0.0.6'

0 commit comments

Comments
 (0)