diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8aaa016..626916b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,8 +54,6 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: 3.4.1 - - name: Export version from tag name - run: echo "${{ needs.release-please.outputs.version }}" > VERSION - name: Build Gem run: gem build *.gemspec - name: Setup credentials diff --git a/CLAUDE.md b/CLAUDE.md index 2011225..9729bd9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -121,6 +121,12 @@ feat: Add support for IPv6 destinations feat!: Change default server port to 7778 ``` +### Versioning + +The gem version is defined in `lib/deploy_agent/version.rb` as `DeployAgent::VERSION`. The gemspec reads from this constant via `require_relative`. Release-please is configured (via `version-file` in `release-please-config.json`) to automatically bump the version in this file when creating release PRs. + +**Do not hardcode the version in `deploy-agent.gemspec`** — it must always reference `DeployAgent::VERSION`. + ## Code Style Ruby 2.7+ syntax required. RuboCop configured with: diff --git a/deploy-agent.gemspec b/deploy-agent.gemspec index 037238b..d6f80bd 100644 --- a/deploy-agent.gemspec +++ b/deploy-agent.gemspec @@ -1,8 +1,10 @@ # frozen_string_literal: true +require_relative 'lib/deploy_agent/version' + Gem::Specification.new do |s| s.name = 'deploy-agent' - s.version = '1.3.3' + s.version = DeployAgent::VERSION s.required_ruby_version = '>= 2.7' s.summary = 'The DeployHQ Agent' s.description = 'This gem allows you to configure a secure proxy through which DeployHQ can forward connections' diff --git a/lib/deploy_agent/version.rb b/lib/deploy_agent/version.rb index 771f34a..3a20aff 100644 --- a/lib/deploy_agent/version.rb +++ b/lib/deploy_agent/version.rb @@ -1,17 +1,5 @@ -require "rubygems" +# frozen_string_literal: true module DeployAgent - VERSION_FILE_PATH = File.expand_path('../../../VERSION', __FILE__) - SPEC_FILE_PATH = File.expand_path('../../../deploy-agent.gemspec', __FILE__) - - if File.file?(VERSION_FILE_PATH) - VERSION = File.read(VERSION_FILE_PATH).strip.sub(/\Av/, '') - elsif File.file?(SPEC_FILE_PATH) - VERSION = Gem::Specification::load(SPEC_FILE_PATH).version.to_s - else - puts __FILE__ - - VERSION = '0.0.0.dev' - end - + VERSION = '1.4.0' end diff --git a/release-please-config.json b/release-please-config.json index 174bd21..fd1ca5e 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -3,6 +3,7 @@ "packages": { ".": { "release-type": "ruby", + "version-file": "lib/deploy_agent/version.rb", "changelog-path": "CHANGELOG.md", "bump-minor-pre-major": true, "bump-patch-for-minor-pre-major": true,