main is the only long-lived branch. Changes reach it through pull requests, merge commits only, and
every pull request and push to main must pass the build check (.github/workflows/build.yml: the
specs on Ruby 3.2, 3.3, 3.4 and 4.0, then build and install the gem). Merging publishes nothing.
A release is a GitHub Release whose tag is the version, published by tomasr78:
- In a pull request, set
ConvertApi::VERSIONinlib/convert_api/version.rbto the new version (it is the gem's version and goes into theUser-Agentof every request) and add the version toCHANGELOG.md. Merge it. - Wait for the
buildcheck of that merge onmainto pass, then publish the release:
gh release create v3.0.1 --repo ConvertAPI/convertapi-library-ruby --target main --title v3.0.1 --generate-notesThat runs .github/workflows/publish.yml, which:
- refuses a Release published or re-run by anyone else;
- checks the tag (
v3.0.1,v3.1.0-rc.1), that the GitHub pre-release tick matches the version, that the tagged commit is onmain, thatConvertApi::VERSIONat the tag is the version, and that RubyGems has never had that version; - runs the specs (the ones that call ConvertAPI too, when the
CONVERTAPI_SECRETsecret exists), builds the gem and checks that it installs and reports the version; - pushes the gem to RubyGems from the
rubygemsenvironment with Trusted Publishing (no stored key) and waits until RubyGems serves it.
Pre-releases work the same way and are also tagged on main. RubyGems writes pre-release versions
with dots, so the pre-release label is alpha.N, beta.N or rc.N (v3.1.0-rc.1 is gem version
3.1.0.rc.1, which is what ConvertApi::VERSION must say):
gh release create v3.1.0-rc.1 --repo ConvertAPI/convertapi-library-ruby --target main --prerelease --title v3.1.0-rc.1 --notes "Release candidate for ..."If the run fails before Push to RubyGems, nothing was published: fix the cause and re-run the failed jobs, or delete the Release and its tag and release again. Once pushed, a RubyGems version is permanent: it can be yanked but never pushed again. Fix a bad version by releasing the next one, and never move a release tag.
- Rulesets:
maintakes pull requests with merge commits and a passingbuild(admins can bypass); only repository admins create, move or deletev*tags, and av*tag must bev{major}.{minor}.{patch}with an optional-{alpha|beta|rc}.{n}. - The
rubygemsenvironment accepts deployments fromv*tags only. - RubyGems trusts
ConvertAPI/convertapi-library-ruby, workflowpublish.yml, environmentrubygems(https://rubygems.org/gems/convert_api/trusted_publishers). Renaming the workflow file or the environment breaks publishing until the trusted publisher is changed to match. - Until that trusted publisher exists,
publish.ymlfalls back to theRUBYGEMS_API_KEYrepository secret and says so in a warning. After the first release published by Trusted Publishing, delete the secret and the fallback step.