forked from prontolabs/pronto-rubocop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8ebb91
commit f257338
Showing
1 changed file
with
26 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |