Skip to content

Commit 3cbcbd8

Browse files
authored
Merge pull request #532 from bastelfreak/gem2
Add docs for gem publication
2 parents deba94c + 32a6e7d commit 3cbcbd8

2 files changed

Lines changed: 99 additions & 22 deletions

File tree

_docs/publish_gem.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
layout: post
3+
title: Setting up a gem for publication
4+
date: 2025-08-13
5+
summary: Steps to do to enable publication of a new gem
6+
---
7+
8+
Those are the steps you have to take to publish a new gem:
9+
10+
11+
## Setup GitHub workflow
12+
13+
Right now we don't have a way to sync workflows for each gem.
14+
Copy the [release workflow](https://github.com/voxpupuli/gem-workflow-test/blob/master/.github/workflows/release.yml) from our [boilerplate gem](https://github.com/voxpupuli/gem-workflow-test).
15+
This workflow will take care of:
16+
17+
* Building the gem
18+
* Creating a GitHub and rubygems.org release
19+
* Attaching the gem to the GitHub release
20+
* Creating the changelog for the GitHub release
21+
* Waits until the new version is present on the rubygems.org cache
22+
23+
### Configure rubygems.org
24+
25+
**This needs to be done by a PMC member**
26+
27+
Before the first release, trusted publishing needs to be configured on rubygems.org
28+
29+
* login to rubygems.org with the voxpupui or openvoxproject account from gopass
30+
* go to https://rubygems.org/profile/oidc/pending_trusted_publishers
31+
* click "create"
32+
* add gem name, repo owner ("voxpupuli" or "OpenVoxProject"), repo name (usually same as gem name), workflow name (`release.yml`)
33+
* Set environment to `release` ([configured in our workflow](https://github.com/voxpupuli/gem-workflow-test/blob/96a29ada7ddea2ba0f27cbe0efd2194c7b9e7213/.github/workflows/release.yml#L71))
34+
35+
This step has to be done at maximum 48h before the first release, or rubygems.org deletes the configuration
36+
The configuratin can be added again if rubygems.org deleted it.
37+
38+
## Setup the GitHub Changelog configuration
39+
40+
Copy the [config yaml](https://github.com/voxpupuli/gem-workflow-test/blob/master/.github/release.yml).
41+
This will ensure that all closed issues and PRs with labels are sorted into the correct categories.
42+
43+
## Recommendations
44+
45+
### dependabot
46+
47+
We have a basic [dependabot config](https://github.com/voxpupuli/gem-workflow-test/blob/master/.github/dependabot.yml).
48+
It will raise PRs for updates on Ruby dependencies or github action dependencies.
49+
We highly recommend that you copy the file.
50+
51+
### Gemfile
52+
53+
We recommend that the Gemfile contains a `release` gem group:
54+
55+
```ruby
56+
group :release, optional: true do
57+
gem 'faraday-retry', '~> 2.1', require: false
58+
gem 'github_changelog_generator', '~> 1.16.4', require: false
59+
end
60+
```
61+
62+
### Rakefile
63+
64+
With the `changelog` rake task, you can follow our [release documentation](https://voxpupuli.org/docs/releasing_gem/).
65+
Put the following in a Rakefile (adjust the `config.project` value):
66+
67+
```ruby
68+
begin
69+
require 'rubygems'
70+
require 'github_changelog_generator/task'
71+
rescue LoadError
72+
else
73+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
74+
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog dependencies]
75+
config.user = 'voxpupuli'
76+
config.project = 'json-schema'
77+
gem_version = Gem::Specification.load("#{config.project}.gemspec").version
78+
config.future_release = "#{gem_version}"
79+
end
80+
end
81+
```

_docs/releasing_gem.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ date: 2023-02-25
55
summary: How to perform a complete version release
66
---
77

8-
The release process is split into two parts. Part one can be done by anybody
9-
with a GitHub account. You do not need to be part of the Vox Pupuli GitHub
10-
organisation.
8+
The release process is split into two parts.
9+
Part one can be done by anybody with a GitHub account.
10+
You do not need to be part of the Vox Pupuli GitHub organisation.
1111

1212
## Part 1: Create a 'release pr'
1313

14-
This pull request updates the changelog and bumps the version number to the
15-
target version. The version is set in the gemspec file in the root of the git
16-
repository. Sometimes it's a variable coming from something like
17-
`lib/$gem/version.rb`. An example is [beaker](https://github.com/voxpupuli/beaker/blob/f60ac9413f9c7976a6645ef9e1dd2afbcc6542de/beaker.gemspec#L8),
18-
([version.rb](https://github.com/voxpupuli/beaker/blob/master/lib/beaker/version.rb#L3)). This can be done from a fork.
14+
This pull request updates the changelog and bumps the version number to the target version.
15+
The version is set in the gemspec file in the root of the git repository.
16+
Sometimes it's a variable coming from something like `lib/$gem/version.rb`.
17+
An example is [beaker](https://github.com/voxpupuli/beaker/blob/f60ac9413f9c7976a6645ef9e1dd2afbcc6542de/beaker.gemspec#L8), ([version.rb](https://github.com/voxpupuli/beaker/blob/master/lib/beaker/version.rb#L3)).
18+
This can be done from a fork.
1919

2020
Now you can install the changelog generator:
2121

@@ -31,25 +31,24 @@ And in case you installed the gems before:
3131
bundle install; bundle update; bundle clean
3232
```
3333

34-
We can generate the changelog (in most cases, this requires a
35-
[GitHub access token (docs on how to create one)](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line):
36-
the changelog generator expects the token in the environment variable `CHANGELOG_GITHUB_TOKEN`).
34+
We can generate the changelog (in most cases, this requires a [GitHub access token (docs on how to create one)](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line): the changelog generator expects the token in the environment variable `CHANGELOG_GITHUB_TOKEN`).
3735

3836
```bash
3937
CHANGELOG_GITHUB_TOKEN='mytoken' bundle exec rake changelog
4038
```
4139

42-
The changelog generator checks for certain labels on closed issues and PRs since
43-
the last release and groups them together. If the changes were neither
44-
backwards-incompatible nor only bug fixes, make a minor release. Check the
45-
generated diff for the CHANGELOG.md. If your chosen release version doesn't
46-
match the generated changelog, update gemspec and run the changelog task again.
40+
The changelog generator checks for certain labels on closed issues and PRs since the last release and groups them together.
41+
If the changes were neither backwards-incompatible nor only bug fixes, make a minor release.
42+
Check the generated diff for the CHANGELOG.md.
43+
If your chosen release version doesn't match the generated changelog, update gemspec and run the changelog task again.
4744

4845
Get community feedback on the release pr, label it with skip-changelog, get it merged.
4946

5047
## Part 2: Actually create the release
5148

52-
Checkout an updated copy of voxpupuli master. Do not use a fork here. Or add voxpupuli as a additional remote to your fork.
49+
Checkout an updated copy of voxpupuli HEAD branch (main or master).
50+
Do not use a fork here.
51+
Or add voxpupuli as a additional remote to your fork.
5352

5453
with the main repo
5554

@@ -66,10 +65,8 @@ git switch master
6665
git pull --rebase voxpupuli master
6766
```
6867

69-
70-
Check with `git tag -l` if the git tags are prefixed with a v or not. This varies
71-
by project (we often adopt gems from other people and don't want to change the
72-
versioning scheme in a project).
68+
Check with `git tag -l` if the git tags are prefixed with a v or not.
69+
This varies by project (we often adopt gems from other people and don't want to change the versioning scheme in a project).
7370

7471
Create a new git tag with the new version: `git tag -s $version`
7572

@@ -87,5 +84,4 @@ with a fork:
8784
git push voxpupuli $version
8885
```
8986

90-
9187
Then a GitHub action will start to build the gem and publish it to GitHub Packages and RubyGems.org

0 commit comments

Comments
 (0)