Skip to content

Commit

Permalink
Merge pull request #23 from masaakiaoyagi/develop
Browse files Browse the repository at this point in the history
Release preparation
  • Loading branch information
masaakiaoyagi authored Jun 9, 2022
2 parents 2923ffa + 267717f commit fc54bc8
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 8 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: release-please

on:
push:
branches:
- main
# - release

jobs:
release-please:
runs-on: ubuntu-latest
name: Release Ruby gem
environment:
name: rubygems

steps:
- uses: GoogleCloudPlatform/release-please-action@v3
id: release
with:
# default-branch: release
release-type: ruby
package-name: rspec-context_helper
bump-minor-pre-major: true
bump-patch-for-minor-pre-major: false
version-file: "lib/rspec/context_helper/version.rb"

- uses: actions/checkout@v3
# with:
# ref: release
if: ${{ steps.release.outputs.release_created }}

- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.2
bundler-cache: true
if: ${{ steps.release.outputs.release_created }}

- name: Publish gem to rubygems.org
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
if: ${{ steps.release.outputs.release_created }}
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main

pull_request:

jobs:
Expand All @@ -23,10 +22,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Run tests
run: bundle exec rspec
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RSpec::ContextHelper

https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#work-in-progress[image:https://img.shields.io/badge/stability-wip-lightgrey.svg[stability-wip]]
https://github.com/masaakiaoyagi/rspec-context_helper.rb/releases[image:https://img.shields.io/github/v/release/masaakiaoyagi/rspec-context_helper.rb?include_prereleases[GitHub release (latest SemVer including pre-releases)]]
https://github.com/masaakiaoyagi/rspec-context_helper.rb/actions/workflows/test.yml[image:https://github.com/masaakiaoyagi/rspec-context_helper.rb/actions/workflows/test.yml/badge.svg[test]]
https://opensource.org/licenses/MIT[image:https://img.shields.io/badge/License-MIT-yellow.svg[License: MIT]]
https://conventionalcommits.org[image:https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white[Conventional Commits]]
Expand Down
52 changes: 52 additions & 0 deletions docs/workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Workflow

## Development

```mermaid
gitGraph
commit tag: "v0.0.1"
branch develop order: 3
commit
commit
branch feature order: 4
commit
commit
checkout develop
merge feature
checkout main
merge develop
branch release-please order: 2
commit
checkout main
merge release-please tag: "v0.0.2"
```

### Release

```mermaid
sequenceDiagram
actor user as Developer
participant main as GitHub<br />main Branch
participant pr as GitHub<br />Pull Request
participant release as GitHub<br />Release
participant runner as GitHub<br />Actions Runner
participant gem as rubygems.org
user ->> main: push
main -->> runner: run release-please workflow
runner -->> release: look for latest release
Note over runner: update version
runner -->> main: collect commits since all latest releases
Note over runner: update CHANGELOG
runner -->> pr: create PR
user ->> gem: disable MFA
user ->> pr: merge
pr -->> main: merge PR
main -->> runner: run release-please workflow
runner -->> release: create Release
Note over runner: create gem
runner -->> gem: publish gem
user ->> gem: enable MFA
```
8 changes: 4 additions & 4 deletions rspec-context_helper.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Gem::Specification.new do |spec|
spec.license = "MIT"
spec.required_ruby_version = ">= 2.7.0"

spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
# spec.metadata["rubygems_mfa_required"] = "true"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/masaakiaoyagi/rspec-context_helper.rb"
spec.metadata["changelog_uri"] = "https://github.com/masaakiaoyagi/rspec-context_helper.rb"
spec.metadata["source_code_uri"] = spec.homepage
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
Expand All @@ -31,5 +31,5 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency "rspec", "~> 3.11"
spec.add_dependency "rspec"
end

0 comments on commit fc54bc8

Please sign in to comment.