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

CI: Gem Publish #41

Merged
merged 2 commits into from
Mar 19, 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
11 changes: 0 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,3 @@ jobs:
id: release
if: github.ref == 'refs/heads/main'

- name: Publish to RubyGems
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 }}
37 changes: 37 additions & 0 deletions .github/workflows/publish-gem.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish Ruby Gem

on:
release:
types: [created]

permissions:
contents: read
pull-requests: read # to detect changes files

jobs:
publish-gem:
name: Publish Ruby Gem
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
# We are not letting this step to run bundle install, we will do it later
bundler-cache: false

- name: Install dependencies
run: bundle install

- name: Publish to RubyGems
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 }}