Skip to content
Merged
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
13 changes: 13 additions & 0 deletions .github/scripts/check-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# Checking if current tag matches the package version
current_tag=$(echo $GITHUB_REF | tr -d 'refs/tags/v')
file_tag=$(grep 'VERSION = ' lib/meilisearch/version.rb | cut -d '=' -f 2- | tr -d ' ' | tr -d \')
if [ "$current_tag" != "$file_tag" ]; then
echo "Error: the current tag does not match the version in package file(s)."
echo "$current_tag vs $file_tag"
exit 1
fi

echo 'OK'
exit 0
30 changes: 30 additions & 0 deletions .github/workflows/gempush.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish Gem

on:
push:
tags:
- v*

jobs:
build:
name: Build + Publish
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Check release validity
run: sh .github/scripts/check-release.sh
- name: Publish to RubyGems
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build meilisearch-rails.gemspec
gem push *.gem
env:
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}