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 release workflow #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Release

on:
workflow_call:
inputs:
allowed_owner:
description: 'Only allow this owner. Used to prevent releasing on forks'
required: true
type: 'string'
ruby_version:
description: 'Ruby version used to build'
default: '3.0'
type: 'string'
secrets:
api_key:
description: 'The Rubygems API key'
required: true

jobs:
release:
runs-on: ubuntu-latest
if: github.repository_owner == inputs.allowed_owner
steps:
- uses: actions/checkout@v4
- name: 'Install Ruby ${{ inputs.ruby_version }}'
uses: ruby/setup-ruby@v1
with:
ruby-version: '${{ inputs.ruby_version }}'
- name: Build gem
run: gem build *.gemspec
- name: Publish gem to rubygems.org
run: gem push *.gem
env:
GEM_HOST_API_KEY: '${{ secrets.api_key }}'
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,26 @@
Shared config and templates.

For details on org shared templates, see: [documentation](https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization).

## Gem release

To release a gem, use the following workflow

```
name: Release

on:
push:
# Pattern matched against refs/tags
tags:
- '**'

jobs:
release:
name: Release gem
uses: fog/.github/.github/workflows/ci.yml@v1.5.0
with:
allowed_owner: MY_USERNAME
secrets:
api_key: ${{ secrets.RUBYGEM_API_KEY }}
```