Skip to content

Commit e284833

Browse files
committed
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 ebe9be4 commit e284833

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

.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: 'graphql'
18+
919
publish-rockspec-scm-1:
1020
if: github.ref == 'refs/heads/master'
1121
runs-on: ubuntu-20.04
@@ -18,6 +28,7 @@ jobs:
1828

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

graphql-scm-1.rockspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ build = {
2121
type = 'builtin',
2222
modules = {
2323
['graphql.init'] = 'graphql/init.lua',
24+
['graphql.version'] = 'graphql/version.lua',
2425
['graphql.execute'] = 'graphql/execute.lua',
2526
['graphql.introspection'] = 'graphql/introspection.lua',
2627
['graphql.parse'] = 'graphql/parse.lua',

graphql/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
return {VERSION = 'unknown'}
1+
return {_VERSION = require('graphql.version')}

graphql/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.2.0'

test/unit/graphql_test.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ function g.test_util_find_by_name()
10901090
end
10911091

10921092
g.test_version = function()
1093-
t.assert_type(require('graphql').VERSION, 'string')
1093+
t.assert_type(require('graphql')._VERSION, 'string')
10941094
end
10951095

10961096
function g.test_is_array()

0 commit comments

Comments
 (0)