Skip to content

Commit 29c3600

Browse files
bors[bot]CaroFG
andauthored
Merge #33
33: Push to rubygems r=CaroFG a=CaroFG Closes #14 Co-authored-by: CaroFG <[email protected]> Co-authored-by: CaroFG <[email protected]>
2 parents 9c75567 + 9a8d556 commit 29c3600

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.github/scripts/check-release.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
# Checking if current tag matches the package version
4+
current_tag=$(echo $GITHUB_REF | tr -d 'refs/tags/v')
5+
file_tag=$(grep 'VERSION = ' lib/meilisearch/version.rb | cut -d '=' -f 2- | tr -d ' ' | tr -d \')
6+
if [ "$current_tag" != "$file_tag" ]; then
7+
echo "Error: the current tag does not match the version in package file(s)."
8+
echo "$current_tag vs $file_tag"
9+
exit 1
10+
fi
11+
12+
echo 'OK'
13+
exit 0

.github/workflows/gempush.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish Gem
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
build:
10+
name: Build + Publish
11+
runs-on: ubuntu-20.04
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Ruby 2.6
16+
uses: actions/setup-ruby@v1
17+
with:
18+
ruby-version: 2.6.x
19+
- name: Check release validity
20+
run: sh .github/scripts/check-release.sh
21+
- name: Publish to RubyGems
22+
run: |
23+
mkdir -p $HOME/.gem
24+
touch $HOME/.gem/credentials
25+
chmod 0600 $HOME/.gem/credentials
26+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
27+
gem build meilisearch-rails.gemspec
28+
gem push *.gem
29+
env:
30+
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}

0 commit comments

Comments
 (0)