Skip to content

Commit 094cbf9

Browse files
GRISHNOVLeonidVas
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 2f157c9 commit 094cbf9

File tree

5 files changed

+35
-1
lines changed

5 files changed

+35
-1
lines changed

.github/workflows/packaging.yml

+17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@ 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: 'queue'
21+
622
package:
723
# Skip pull request jobs when the source branch is in the same
824
# repository.
@@ -12,6 +28,7 @@ jobs:
1228
# Packaging for CentOS 7 does not work with other versions, see:
1329
# https://github.com/packpack/packpack/issues/145
1430
runs-on: ubuntu-20.04
31+
needs: version-check
1532

1633
strategy:
1734
fail-fast: false

.github/workflows/publish.yml

+11
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: 'queue'
18+
919
publish-rockspec-scm-1:
1020
if: github.ref == 'refs/heads/master'
1121
runs-on: ubuntu-latest
@@ -19,6 +29,7 @@ jobs:
1929
publish-rockspec-tag:
2030
if: startsWith(github.ref, 'refs/tags/')
2131
runs-on: ubuntu-latest
32+
needs: version-check
2233
steps:
2334
- uses: actions/checkout@v3
2435

queue-scm-1.rockspec

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ build = {
2727
['queue.abstract.driver.limfifottl'] = 'queue/abstract/driver/limfifottl.lua',
2828
['queue.compat'] = 'queue/compat.lua',
2929
['queue.util'] = 'queue/util.lua',
30-
['queue'] = 'queue/init.lua'
30+
['queue'] = 'queue/init.lua',
31+
['queue.version'] = 'queue/version.lua'
3132
}
3233
}
3334

queue/init.lua

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ queue = setmetatable({
3939
register_driver = register_driver,
4040
state = queue_state.show,
4141
cfg = deferred_cfg,
42+
_VERSION = require('queue.version'),
4243
}, { __index = function()
4344
print(debug.traceback())
4445
error('Please configure box.cfg{} in read/write mode first')

queue/version.lua

+4
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 '1.2.5'

0 commit comments

Comments
 (0)