Automate release and publishing logic for Ruby
This MR introduces the following enhancements and automations for managing the Ruby Gem and deployment pipeline using a Makefile and GitLab CI/CD:
Makefile Enhancements:
-
Package Building:
- The
build
target is responsible for building the Ruby Gem, copying assets likeconfig
,LICENSE
, andCONTRIBUTING.md
, and cleaning up post-build.
- The
-
Asset Management:
- The
copy-assets
target handles copying configuration files and assets to the package directory.
- The
-
Cleaning:
- A
clean
target is provided to clean up the copied assets from the package directory.
- A
CI/CD Pipeline Enhancements:
-
Ruby Release Process:
-
Build and Package:
-
build:ruby:env
: Parses the Ruby gem version fromlib/gitlab/cloud_connector/version.rb
and stores it in the environment. -
build:ruby:gem
: Builds the Ruby Gem usingmake build
. (it copies config/** files, LICENSE and CONTRIBUTING.md file to be included in the package)
-
-
Smoke Testing:
-
build:ruby:gem:smoke-test
: Installs the built Ruby gem and performs a basic import test to ensure that the gem was built correctly.
-
-
Release Creation:
-
release:ruby:creation
: Creates a ruby release in GitLab based on the gathered release notes and commit information (latest Configuration change - latest commit sha and commit date)
-
-
Publishing to Ruby.org:
-
release:ruby:gem:publication
: Publishes the built Ruby gem to RubyGems.org repository.
-
-
Build and Package:
Pipeline Stages:
-
Test Stage:
- Linting, formatting, and testing steps are included, ensuring code quality before building the package.
-
Deploy Stage:
- Builds the Ruby gem, tests it, and prepares for release.
-
Release Stage:
- Creates a GitLab release and publishes the package to RubyGems.org.
NOTE: The Ruby deploy and release jobs are only triggered if the version has changed in src/ruby/lib/gitlab/cloud_connector/version.rb, and the change is merged to the
main` branch.
Edited by Nikola Milojevic