Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI/CD to publish gem #201

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion .github/workflows/ci-ruby.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: 💎
on:
push:
tags:
- 'v*.*.*'
branches:
- main
paths:
Expand Down Expand Up @@ -55,5 +57,41 @@ jobs:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
bundler-cache: true
- run: bundle exec rake rubocop

build_and_release:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: mkdir -p pkg
- run: bundle exec gem build --strict --norc --output=pkg/irb-power_assert.gem irb-power_assert.gemspec
Copy link
Owner Author

Choose a reason for hiding this comment

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

Better than rake build for this purpose, I think

- name: Upload artifact
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: '${{ github.sha }}-irb-power_assert.gem'
path: pkg/irb-power_assert.gem
- uses: kachick/wait-other-jobs@v3
if: startsWith(github.ref, 'refs/tags/')
with:
skip-list: |
[
{
"workflowFile": "merge-bot-pr.yml"
}
]
# Only tagged and push to GitHub, you should publish to rubygems.org with OTP
- name: Release
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # v2.0.4
if: startsWith(github.ref, 'refs/tags/')
with:
files: pkg/irb-power_assert.gem
- name: Inspect the gem
run: |
cd pkg
sha256sum ./irb-power_assert.gem
gem unpack ./irb-power_assert.gem
tree -I *.gem
7 changes: 7 additions & 0 deletions .github/workflows/merge-bot-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
uses: kachick/wait-other-jobs@v3
with:
skip-same-workflow: 'true'
skip-list: |
[
{
"workflowFile": "ci-ruby.yml",
"jobName": "build_and_release"
}
]
timeout-minutes: 10
- name: Approve and merge
if: ${{ (steps.metadata.outputs.update-type != 'version-update:semver-major') || contains(steps.metadata.outputs.dependency-names, 'DeterminateSystems') }}
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ If only changing Ruby code, this step is unnecessary
> dprint --version
...
```

## How to release

1. Push tags as `v0.4.2`
2. `curl ... && gem push ...` # `<UPDATE ME>`
3 changes: 1 addition & 2 deletions irb-power_assert.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ repository_url = "https://github.com/kachick/#{lib_name}"

Gem::Specification.new do |gem|
gem.summary = %q{power_assert in irb}
gem.description = gem.summary
gem.description = %q{Use power_assert inspection in irb}
gem.homepage = repository_url
gem.license = 'MIT'
gem.name = lib_name
gem.version = IRB::PowerAssert::VERSION

gem.metadata = {
'homepage_uri' => repository_url,
'source_code_uri' => repository_url,
'bug_tracker_uri' => "#{repository_url}/issues",
'rubygems_mfa_required' => 'true',
Expand Down
2 changes: 1 addition & 1 deletion lib/irb/power_assert/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

module IRB
module PowerAssert
VERSION = '0.2.0'
VERSION = '0.3.0'
end
end