Skip to content

Commit

Permalink
api: add hardcoded versioning support
Browse files Browse the repository at this point in the history
Added the _VERSION variable to the exported table.
Is part of the task [1].

1. github.com/tarantool/roadmap-internal/issues/204
  • Loading branch information
GRISHNOV committed Mar 13, 2023
1 parent 78425a7 commit 99165bb
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 6 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,20 @@ on:
- '*'

jobs:
# Run not only on tags, otherwise dependent job will skip.
version-check:
runs-on: ubuntu-20.04
steps:
- name: Check module version
# We need this step to run only on push with tag.
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
uses: tarantool/actions/check-module-version@master
with:
module-name: 'expirationd'

package:
runs-on: ubuntu-20.04
needs: version-check

strategy:
fail-fast: false
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ on:
tags: ['*']

jobs:
version-check:
# We need this job to run only on push with tag.
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-20.04
steps:
- name: Check module version
uses: tarantool/actions/check-module-version@master
with:
module-name: 'expirationd'

publish-rockspec-scm-1:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-20.04
Expand All @@ -18,6 +28,7 @@ jobs:

publish-rockspec-tag:
if: startsWith(github.ref, 'refs/tags/')
needs: version-check
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
Expand Down
1 change: 0 additions & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
globals = {
"box",
"_TARANTOOL",
"_VERSION",
}

ignore = {
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Added

- Add versioning support (#136).

### Changed

### Fixed
Expand Down
1 change: 1 addition & 0 deletions expirationd-scm-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ build = {
type = "builtin",
modules = {
["expirationd"] = "expirationd/init.lua",
["expirationd.version"] = "expirationd/version.lua",
["cartridge.roles.expirationd"] = "cartridge/roles/expirationd.lua",
}
}
Expand Down
12 changes: 7 additions & 5 deletions expirationd/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -682,15 +682,14 @@ local function default_iterate_with(task)
end
end


-- ========================================================================= --
-- Expiration daemon management functions
-- Expiration daemon management functions and module constants
-- ========================================================================= --
--
-- {{{ Module functions
-- {{{ Module functions and constants
--

--- Module functions
--- Module functions and constants
--
-- @section Functions

Expand Down Expand Up @@ -1311,6 +1310,9 @@ return {
get_tasks = get_tasks_obsolete,
run_task = run_task_obsolete,
show_task_list = show_task_list_obsolete,

--- Current module version in string format `MAJOR.MINOR.PATCH`.
_VERSION = require('expirationd.version'),
}

-- }}} Module functions
-- }}} Module functions and constants
4 changes: 4 additions & 0 deletions expirationd/version.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Сontains the module version.
-- Requires manual update in case of release commit.

return '1.3.1'

0 comments on commit 99165bb

Please sign in to comment.