Skip to content

Commit

Permalink
Update push
Browse files Browse the repository at this point in the history
  • Loading branch information
maxveldink committed Mar 29, 2022
1 parent c8ebb91 commit f257338
Showing 1 changed file with 26 additions and 32 deletions.
58 changes: 26 additions & 32 deletions .github/workflows/gem-push.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
name: Push Gem
name: Ruby Gem

on:
push:
branches:
- master
branches: [ master ]

jobs:
build:
runs-on: ubuntu-20.04
name: Build + Publish
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2
- name: Ruby gem cache
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Bundle Setup
run: |
gem install --no-document bundler
bundle config path ${{ github.workspace }}/vendor/bundle
- name: Bundle Install
run: bundle install --jobs 4 --retry 3
- 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 )
gem build pronto-rubocop.gemspec
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
gem push *.gem
- uses: actions/checkout@v3
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7.x

- name: Publish to GPR
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
env:
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
OWNER: ${{ github.repository_owner }}

0 comments on commit f257338

Please sign in to comment.