diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2ff6119 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Release + +on: + release: + types: [published] + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2" + bundler-cache: true + + - name: Run tests + run: bundle exec rspec + + - name: Verify release tag matches gemspec + run: | + GEM_VERSION=$(ruby -r ./lib/data_nexus/version -e "puts DataNexus::VERSION") + TAG_VERSION=${GITHUB_REF_NAME#v} + if [ "$GEM_VERSION" != "$TAG_VERSION" ]; then + echo "::error::Version mismatch: gemspec has $GEM_VERSION but tag is $TAG_VERSION" + exit 1 + fi + echo "Version verified: $GEM_VERSION" + + - name: Build gem + id: build + run: | + gem build data_nexus.gemspec + GEM_FILE=$(ls data_nexus-*.gem) + echo "gem_file=$GEM_FILE" >> $GITHUB_OUTPUT + echo "Built: $GEM_FILE" + + - name: Push to RubyGems + run: gem push ${{ steps.build.outputs.gem_file }} + env: + GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} diff --git a/README.md b/README.md index cdaff87..91b3d1c 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,6 @@ Ruby client for the DataNexus API. ## Installation -Install from GitHub (before gem is published): - -```ruby -gem 'data_nexus', git: 'https://github.com/DartHealth/datanexus-ruby.git', tag: 'v0.1.0' -``` - -Or from RubyGems (once published): - ```ruby gem 'data_nexus' ``` diff --git a/data_nexus.gemspec b/data_nexus.gemspec index 4be29fa..4e2af13 100644 --- a/data_nexus.gemspec +++ b/data_nexus.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |spec| spec.email = ['alexkibler@me.com'] spec.summary = 'Ruby client for the DataNexus API' - spec.description = "A Ruby gem for interacting with the Dart Health's DataNexus API." + spec.description = "A Ruby gem for interacting with Dart Health's Data Nexus API." spec.homepage = 'https://github.com/DartHealth/datanexus-ruby' spec.license = 'MIT' spec.required_ruby_version = '>= 3.0.0'