Skip to content

Commit

Permalink
build: read version from git or env
Browse files Browse the repository at this point in the history
  • Loading branch information
thde committed Oct 22, 2024
1 parent c12924a commit f5c97a8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

2 changes: 1 addition & 1 deletion netbox-client-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Gem::Specification.new do |spec|
spec.name = 'netbox-client-ruby'
spec.version = File.read(File.expand_path('VERSION', __dir__)).strip

This comment has been minimized.

Copy link
@n-rodriguez

n-rodriguez Oct 22, 2024

Contributor

IMHO this is a bad idea to do this. git is not always available (or you're not always on git tag) which leads to error messages in the terminal which can be avoided.

spec.version = `git describe --tags --match="v[0-9]*" --abbrev=0`.strip.delete_prefix("v")

spec.summary = 'A read/write client for Netbox v2.'
spec.homepage = 'https://github.com/ninech/netbox-client-ruby'
Expand Down

0 comments on commit f5c97a8

Please sign in to comment.