Skip to content

Commit

Permalink
Merge pull request #201 from kachick/action-build-gem
Browse files Browse the repository at this point in the history
Add CI/CD to publish gem
  • Loading branch information
kachick authored May 2, 2024
2 parents b282d9f + ff1102b commit 5665f8f
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 4 deletions.
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
- 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

0 comments on commit 5665f8f

Please sign in to comment.