Skip to content

Release 4.5.0

Release 4.5.0 #23

name: Build and Publish Gem
on:
release:
types: [published]
env:
GH_TOKEN: ${{ github.token }}
jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install Bundler
run: |
sudo gem install bundler
bundle install
- name: Build and push gem
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${{ secrets.GH_RGEMS_KEY }}\n" > $HOME/.gem/credentials
version=$(awk -F'"' '/ VERSION = / {print $2}' < lib/sift/version.rb)
all_versions=$(gem list -r -e --all sift --no-verbose)
if [[ $all_versions != *"$version"* ]]; then
echo "Gem version does not exist on RubyGems. Building and pushing!"
gem build sift.gemspec
gem push sift-$version.gem
rm -rf $HOME/.gem
else
echo "Gem version $version exists on RubyGems"
fi