Skip to content

Commit 16c7091

Browse files
elucidsoftclaude
andcommitted
feat: add GitHub Actions CI/CD and RubyGems publishing setup
- ci.yml: test on Ruby 3.1-3.4 matrix (3.1 allow-failures, EOL), runs rspec + rubocop + yard doc generation on every push/PR - publish.yml: publishes to RubyGems.org on v* tag push, creates GitHub Release with auto-generated notes - gemspec: add allowed_push_host: https://rubygems.org Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 98a3d0b commit 16c7091

3 files changed

Lines changed: 94 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
ruby-version: ['3.2', '3.3', '3.4']
17+
include:
18+
# Ruby 3.1 reached EOL March 2025 — keep in matrix for compatibility
19+
# reporting but allow failures so EOL-only issues don't block PRs
20+
- ruby-version: '3.1'
21+
continue-on-error: true
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up Ruby ${{ matrix.ruby-version }}
27+
uses: ruby/setup-ruby@v1
28+
with:
29+
ruby-version: ${{ matrix.ruby-version }}
30+
bundler-cache: true
31+
32+
- name: Run tests
33+
run: bundle exec rspec
34+
35+
- name: Run linter
36+
run: bundle exec rubocop
37+
38+
- name: Generate YARD docs
39+
run: bundle exec yard doc --no-stats 2>&1 | grep -v "^$" || true
40+
41+
- name: Upload coverage report
42+
uses: actions/upload-artifact@v4
43+
if: matrix.ruby-version == '3.3'
44+
with:
45+
name: coverage
46+
path: coverage/
47+
retention-days: 7

.github/workflows/publish.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish to RubyGems
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
# Packagist-style webhook not needed for RubyGems — publishing is explicit
13+
# via gem push with GEM_HOST_API_KEY secret set in repo settings
14+
15+
permissions:
16+
contents: write # required to create GitHub Release
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Ruby
22+
uses: ruby/setup-ruby@v1
23+
with:
24+
ruby-version: '3.3'
25+
bundler-cache: true
26+
27+
- name: Run tests
28+
run: bundle exec rspec
29+
30+
- name: Run linter
31+
run: bundle exec rubocop
32+
33+
- name: Build gem
34+
run: gem build cloudlayerio.gemspec
35+
36+
- name: Publish to RubyGems.org
37+
env:
38+
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
39+
run: gem push cloudlayerio-*.gem
40+
41+
- name: Create GitHub Release
42+
uses: softprops/action-gh-release@v2
43+
with:
44+
generate_release_notes: true
45+
files: cloudlayerio-*.gem

cloudlayerio.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ Gem::Specification.new do |spec|
2222
'changelog_uri' => 'https://github.com/cloudlayerio/cloudlayerio-ruby/blob/main/CHANGELOG.md',
2323
'documentation_uri' => 'https://cloudlayer.io/docs/sdk-ruby',
2424
'bug_tracker_uri' => 'https://github.com/cloudlayerio/cloudlayerio-ruby/issues',
25-
'rubygems_mfa_required' => 'true'
25+
'rubygems_mfa_required' => 'true',
26+
'allowed_push_host' => 'https://rubygems.org'
2627
}
2728

2829
spec.files = Dir['lib/**/*', 'LICENSE', 'README.md', 'CHANGELOG.md']

0 commit comments

Comments
 (0)