-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (37 loc) · 1.23 KB
/
ruby-gem-publish.yml
File metadata and controls
37 lines (37 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: Publish Ruby Gem
on:
workflow_call:
inputs:
gem-name:
description: "Name of the gem to be published"
type: string
required: true
secrets:
BUNDLE_RUBYGEMS__PKG__GITHUB__COM:
description: "The GitHub token to use for private gem sources"
required: true
jobs:
build:
runs-on: ubuntu-latest
env:
BUNDLE_RUBYGEMS__PKG__GITHUB__COM: ${{ secrets.BUNDLE_RUBYGEMS__PKG__GITHUB__COM }}
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Set Credentials
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:github: Bearer ${GITHUB_TOKEN}\n" > $HOME/.gem/credentials
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Publish to GitHub Packages
run: |
export OWNER=$( echo ${{ github.repository }} | cut -d "/" -f 1 )
export GEM_NAME=$( echo ${{ github.repository }} | cut -d "/" -f 2 )
gem build ${{ inputs.gem-name }}.gemspec
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem