Skip to content

build: semi-automated release process#80

Open
extern-c wants to merge 17 commits into
CycloneDX:masterfrom
extern-c:ci-release
Open

build: semi-automated release process#80
extern-c wants to merge 17 commits into
CycloneDX:masterfrom
extern-c:ci-release

Conversation

@extern-c

@extern-c extern-c commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Description

Add a release workflow for RubyGems and GitHub Releases triggered by version tags (v*.*.*).

This PR resolves issue: #46.

The workflow consists of three jobs:

  1. Test: runs the test suite using Ruby 3.3.
  2. RubyGems Release: publishes the gem to RubyGems using trusted publishing.
  3. GitHub Release: creates a GitHub Release with generated release notes.

The GitHub Release does not include a built gem package and is intended only for release metadata and assets.

Future Improvements

To keep this change focused, a few related enhancements are left for follow-up work:

  • Verify that the gem version matches the release tag before publishing.
  • Ensure the tagged commit is reachable from a protected release branch (e.g. main) before publishing to reduce the risk of releasing from an unreviewed commit outside the normal development workflow.
  • Generate and publish SHA hashes for release assets.
  • Document the release process (e.g. updating the gem version, creating and publishing a release tag, and publishing a release). Updated CONTRIBUTING.md in commit 5545c7c.

Release documentation will be added in a follow-up PR.

Testing

The workflow has been validated to the extent possible, but I was unable to perform an end-to-end test for the RubyGems publishing step because trusted publishing requires maintainer-controlled RubyGems and repository configuration.

A maintainer will need to:

  • Create and configure a release environment if one does not already exist.
  • Configure RubyGems trusted publishing for the repository/environment.
  • Perform a test release to verify that the trusted publishing configuration is set up correctly.

AI Tool Disclosure

  • My contribution does not include any AI-generated content
  • My contribution includes AI-generated content, as disclosed below:
    • AI Tools: [e.g. GitHub CoPilot, ChatGPT, JetBrains Junie etc.]
    • LLMs and versions: [e.g. GPT-4.1, Claude Haiku 4.5, Gemini 2.5 Pro etc.]
    • Prompts: [Summarize the key prompts or instructions given to the AI tools]

Affirmation

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@extern-c extern-c force-pushed the ci-release branch 3 times, most recently from f94b6a6 to e19047f Compare July 1, 2026 03:44
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
@extern-c extern-c marked this pull request as ready for review July 2, 2026 23:30
@extern-c extern-c requested a review from a team as a code owner July 2, 2026 23:30
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>

@jkowalleck jkowalleck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the release process looks very promising. 👍

Release documentation will be added in a follow-up PR.

Docs shall happen when changes happen.

Could you please add some docs how this all works and how it is triggered?
This might go here: CONTRIBUTING.md section "To release a new version".
You might want to remove the "Manual process" and add a "Semi-Automated process" or whatever sounds appropriate

please also add a description of the build changes to CHANGELOG.md

needs: rubygems_release
environment: release
permissions:
contents: write

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a comment why this permission is needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in e3c2541. Thanks for the suggestion.

Comment thread .github/workflows/release.yml Outdated
timeout-minutes: 10
needs: test
permissions:
contents: write

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add comments why the permissions are needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 51b50f1. Thanks for the suggestion.

Comment thread .github/workflows/release.yml Outdated
persist-credentials: false
- name: Create GitHub Release
run: |
gh release create "${{ github.ref_name }}" \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gh release create "${{ github.ref_name }}" \
gh release create "$GITHUB_REF_NAME" \

see

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 2106cb1. Thanks for the suggestion.

with:
persist-credentials: false
- name: Create GitHub Release
run: |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rework this to

run: >
  gh release create ...
  --verify-tag
  ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see 9e50640.

ruby-version: ruby
bundler-cache: false
- name: "Push gem to RubyGems"
uses: rubygems/release-gem@6317d8d1f7e28c24d28f6eff169ea854948bd9f7 # v1.2.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a comment with the action's URL for easier docks lookup when maintaining.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in da61dd3. Thanks for the suggestion.

Comment thread .github/workflows/release.yml Outdated
run: |
gh release create "${{ github.ref_name }}" \
--verify-tag \
--generate-notes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to see the "--prerelease" marker in case the tag looks like one.
This will be especially needed to test the release process before merging the PR.

Possible way to do this: similar to https://github.com/CycloneDX/cyclonedx-buildroot/blob/main/.github/workflows/release.yml

  1. add a new job that determines whether this is a prerelease
  • do a pattern-math on the version string
  • set an output parameter properly
  1. have the release process depend on the newly added job
  2. when creating the GH release: reflect on the outcome and flag as prerelease if needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in 9e50640.

Comment thread .github/workflows/release.yml Outdated

on:
push:
tags: ["v*"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better go with

Suggested change
tags: ["v*"]
tags: ["v*.*.*"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 3e9e0ba. Thanks for the suggestion.

uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Create GitHub Release

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could the release have the gem as a release asset?
It would be ideal to use the one produced in the rubygems_release job - you could use https://docs.github.com/en/actions/concepts/workflows-and-actions/workflow-artifacts to transfer a file from one job to the other. (artifact lifetime of 1 day should be enough)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be okay with deferring this for now? I don't think it's necessary to include the built gem in the GitHub release since it'll already be published to RubyGems, and anyone can build it from the release assets. AFAIK, rubygems/release-gem does not produce a build artifact, so we'd need to add additional steps to build the gem and upload it separately.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just artifact pkg/*.gem at the end of the rubygems_release should work, right?

I mean, rubygems/release-gem does not do any magic, it just calls bundle exec rake release which will cause emitting files pkg/*.gem.
see https://github.com/rubygems/release-gem/blob/052cc82692552de3ef2b81fd670e41d13cba8092/action.yml#L60-L67

@extern-c extern-c Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rechecked the rubygems/release-gem behavior and think that the generated gem remains available after the release step, so it should be reusable as you suggested 👍. See commit 2af378b.

@jkowalleck jkowalleck changed the title Add release workflow build: semi-automated release process Jul 3, 2026
extern-c added 3 commits July 4, 2026 11:20
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
extern-c added 3 commits July 4, 2026 19:17
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new GitHub Actions workflow to run tests and perform a semi-automated release flow on version tag pushes, targeting RubyGems (trusted publishing) and GitHub Releases.

Changes:

  • Introduces a Release workflow triggered on version tag pushes.
  • Adds a test job that runs the rake default task on Ruby 3.3.9 before releasing.
  • Adds jobs to publish to RubyGems via trusted publishing and create a GitHub Release with generated notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


on:
push:
tags: ["v*.*.*"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description has been updated to reflect the actual tag trigger.

Comment thread .github/workflows/release.yml Outdated
Comment on lines +7 to +8
permissions:
contents: read

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in a7352f6.

Comment thread .github/workflows/release.yml Outdated
# see https://github.com/ruby/setup-ruby
uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74 # v1.314.0
with:
ruby-version: ruby

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 98c2176.

timeout-minutes: 10
needs: test
permissions:
contents: write # Required for `rake release` to perform git synchronization.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional. This CI job follows the rubygems/release-gem usage documentation. Although actions/checkout is configured with persist-credentials: false, the rubygems/release-gem action configures Git authentication itself using github.token (its token input defaults to ${{ github.token }}). See:

https://github.com/rubygems/release-gem#usage
https://github.com/rubygems/release-gem/blob/v1/action.yml#L10

extern-c added 2 commits July 10, 2026 22:27
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
@jkowalleck jkowalleck requested review from Copilot and jkowalleck July 11, 2026 16:21
@jkowalleck

Copy link
Copy Markdown
Member

will review in a week, please ping me if this is ready.
after review, I might trigger a pre-release of this :-)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment on lines +3 to +6
on:
push:
tags: ["v*.*.*"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe bundle exec rake release already handles this case by checking whether the version tag exists before attempting to create it. See the relevant implementation in Bundler's GemHelper:

  1. https://github.com/ruby/rubygems/blob/v3.6.9/bundler/lib/bundler/gem_helper.rb#L67
  2. https://github.com/ruby/rubygems/blob/v3.6.9/bundler/lib/bundler/gem_helper.rb#L76.

So a workflow triggered by an existing tag shouldn't fail simply because the tag is already present.

Comment on lines +49 to +52
uses: ruby/setup-ruby@9eb537ca036ebaed86729dcb9309076e4c5c3b74 # v1.314.0
with:
ruby-version: '3.4' # Stable environment to package the gem for the supported ruby versions
bundler-cache: false

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this adds much value here, but let me know if you think it's worth pinning.

Comment on lines +78 to +81
# Determine release type from tag suffix
if [[ "$GITHUB_REF_NAME" =~ -(alpha|beta|rc|pre)[0-9.]*$ ]]; then
FLAGS+=("--prerelease")
fi

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkowalleck, do you want to support dot-separated prerelease tags (e.g. v1.2.3.pre.1)?

extern-c added 3 commits July 15, 2026 23:38
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
@extern-c

Copy link
Copy Markdown
Contributor Author

the release process looks very promising. 👍

Release documentation will be added in a follow-up PR.

Docs shall happen when changes happen.

Could you please add some docs how this all works and how it is triggered? This might go here: CONTRIBUTING.md section "To release a new version". You might want to remove the "Manual process" and add a "Semi-Automated process" or whatever sounds appropriate

please also add a description of the build changes to CHANGELOG.md

I've updated CHANGELOG.md and CONTRIBUTING.md in commits e92d1bd and 5545c7c, respectively.

extern-c added 2 commits July 16, 2026 04:09
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
Signed-off-by: Amauri Bizerra <10775696+extern-c@users.noreply.github.com>
@extern-c extern-c closed this Jul 17, 2026
@extern-c extern-c reopened this Jul 17, 2026
@extern-c

Copy link
Copy Markdown
Contributor Author

will review in a week, please ping me if this is ready. after review, I might trigger a pre-release of this :-)

@jkowalleck, this is now ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants