Skip to content

Commit

Permalink
chore: manually publish gem
Browse files Browse the repository at this point in the history
- add CONTRIBUTING.md (contributers should use conventional commits)
- doc.yml: only publish pages on release
- publish-gem.yml: input OTP code when publishing to rubygems.org
- add links section to README
  • Loading branch information
monora committed Jun 19, 2023
1 parent 2e3bec9 commit 2231788
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 20 deletions.
66 changes: 66 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Contributing to Ruby Graph Library

Thank you for your interest in contributing to rgl! We welcome all
contributions, whether they're big or small. Here are some guidelines to get you
started.

## Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By
participating in this project you agree to abide by its terms.

## How to Contribute

1. Fork the repository.
2. Create a branch for your changes: `git checkout -b my-feature-branch`
3. Make your changes and commit them with descriptive commit messages.
4. Ensure that tests pass by running `bundle exec rake` locally.
5. Push your changes to your fork: `git push origin my-feature-branch`
6. Submit a pull request with your changes.

## Commit Guidelines

We follow the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) guidelines for commit
messages in this repository. Please ensure that all commit messages follow the
format:

```
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
```

Where:
- =<type>=: The type of change being made (e.g. feat, fix, docs, style, refactor, test, chore)
- =<scope>= (optional): The scope of the change (e.g. component name, file name)
- =<description>=: A brief description of the change
- =[optional body]=: A more detailed description of the change
- =[optional footer(s)]=: Any important information related to the change, such
as a breaking change note

By following these guidelines, it will be easier to understand the purpose of
each commit and track changes over time.

Please note that we may ask you to amend your commit message(s) if they do not
follow these guidelines.

## Issue Tracker

If you find a bug or want to request a new feature, please create an issue in
the GitHub issue tracker. Please provide as much detail as possible, including
steps to reproduce the issue (if applicable).

## Code Reviews

All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult [GitHub
Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.

## License

By contributing, you agree that your contributions will be licensed under the
[Ruby License](../LICENSE).
9 changes: 5 additions & 4 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Doc
name: Publish Documentation

on:
push:
branches:
- "master"
release:
types: [published]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -25,6 +24,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/publish-gem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Push to rubygems.org

on:
workflow_dispatch:
inputs:
rubygems-otp-code:
description: RubyGems OTP code
required: true
type: string

jobs:
release:
runs-on: ubuntu-latest
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
GEM_HOST_OTP_CODE: ${{ github.event.inputs.rubygems-otp-code }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: config
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: release
run: bundle exec rake release
29 changes: 17 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# .github/workflows/release.yml
# Adapted from: https://blog.dennisokeeffe.com/blog/2022-03-19-automating-rubygem-package-releases-with-github-actions
name: Release
name: Prepare Release

on:
push:
Expand Down Expand Up @@ -45,15 +45,20 @@ jobs:
run: |
bundle exec rake test
if: ${{ steps.release.outputs.release_created }}
# Publish
- name: publish gem

- name: Build docs
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_AUTH_TOKEN}}"
if: ${{ steps.release.outputs.release_created }}
bundle exec rake yard || true
if: ${{ steps.release.outputs.release_created }}
# Publishing to rubygems.org is done in publish-gem.yml in a manual step. Needs OTP.
# - name: publish gem
# 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_AUTH_TOKEN}}"
# if: ${{ steps.release.outputs.release_created }}
3 changes: 2 additions & 1 deletion .yardopts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
-
examples/*.rb
rakelib/dep_graph.rake
ChangeLog
CHANGELOG.md

18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,25 @@ Jeremy Bopp, John Carter, Sascha Doerdelmann, Shawn Garbett, Andreas
Schörk, Dan Čermák, Kirill Lashuk and Markus Napp for contributing additions, test
cases and bugfixes.

See also: https://github.com/monora/rgl/contributors
See also the [list of contributers][5]

## Links

- See [CHANGELOG.md][1] for major/breaking updates, and [releases][2] for a
detailed version history.
- To **contribute**, please read [CONTRIBUTING.md][4] first.
- Please [open an issue][3] if anything is missing or unclear in this
documentation.

## Copying

RGL is Copyright (c) 2002,2004,2005,2008,2013,2015,2019,2020,2022,2023 by Horst
Duchene. It is free software, and may be redistributed under the [Ruby
license](https://en.wikipedia.org/wiki/Ruby_License) and terms specified in
license](.LICENSE) and terms specified in
the LICENSE file.

[1] ./CHANGELOG.md
[2] https://github.com/monora/rgl/releases
[3] https://github.com/monora/rgl/issues/new
[4] ./.github/CONTRIBUTING.md
[5] https://github.com/monora/rgl/contributors
2 changes: 1 addition & 1 deletion rgl.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |s|

s.files = Dir[
'lib/**/*.rb',
'ChangeLog',
'CHANGELOG.md',
'examples/**/*',
'Gemfile',
'README.md',
Expand Down

0 comments on commit 2231788

Please sign in to comment.