Skip to content

Add GitHub Actions CI + RubyGems release pipeline with pre-build version gate#15

Merged
niwo merged 5 commits intomainfrom
copilot/add-github-actions-for-deployment
Apr 15, 2026
Merged

Add GitHub Actions CI + RubyGems release pipeline with pre-build version gate#15
niwo merged 5 commits intomainfrom
copilot/add-github-actions-for-deployment

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

This PR adds GitHub Actions workflows for deployment/release automation and RubyGems publishing. It also enforces a release safety check so publishing only proceeds when the gem version has been bumped above the latest version already published on RubyGems.

  • CI workflow (.github/workflows/ci.yml)

    • Runs on push and pull_request
    • Executes test + gem build on Ruby 3.2, 3.3, 3.4
    • Sets minimal workflow permissions (contents: read)
  • Release workflow (.github/workflows/release.yml)

    • Triggers on release.published and workflow_dispatch
    • Splits into verify and publish jobs
    • Publishes to RubyGems via rubygems/release-gem@v1 using RUBYGEMS_AUTH_TOKEN
    • Uses minimal permissions and a dedicated rubygems environment
  • Version bump enforcement before build

    • In verify, compares local CloudstackClient::VERSION against RubyGems latest (cloudstack_client)
    • Fails early if local version is not greater, preventing accidental duplicate/invalid releases
- name: Ensure version is bumped
  run: |
    CURRENT_VERSION="$(ruby -Ilib -e "require 'cloudstack_client/version'; puts CloudstackClient::VERSION")"
    LATEST_JSON="$(curl -fsSL https://rubygems.org/api/v1/versions/cloudstack_client/latest.json || true)"
    if [ -n "$LATEST_JSON" ]; then
      LATEST_VERSION="$(printf '%s' "$LATEST_JSON" | ruby -rjson -e "puts JSON.parse(STDIN.read)['version']")"
      ruby -e "require 'rubygems/version'; current = Gem::Version.new('$CURRENT_VERSION'); latest = Gem::Version.new('$LATEST_VERSION'); abort('Version must be bumped before building') unless current > latest"
    fi
  • Documentation update (README.md)
    • Adds GitHub Actions release/CI notes
    • Documents required secret: RUBYGEMS_AUTH_TOKEN
    • Notes version bump check behavior

@niwo niwo marked this pull request as ready for review April 15, 2026 21:28
@niwo niwo merged commit c742e5c into main Apr 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants