Tag v1.0.2 #24
Workflow file for this run
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
name: Gem | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
gem-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Publish Gem package | |
env: | |
GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_API_PUSH }}" | |
# Inspired by https://github.com/bodyshopbidsdotcom/gh-action-publish-gem-on-tag/blob/1.0.1/entrypoint.sh | |
# Docs: https://guides.rubygems.org/command-reference/#gem-push | |
run: | | |
GIT_VERSION=$(echo "$GITHUB_REF" | cut -d'/' -f 3-) | |
SPEC_VERSION=$(ruby -e 'require "rubygems"; gemspec = Dir.entries(".").find { |file| file =~ /.*\.gemspec/ }; spec = Gem::Specification::load(gemspec); puts spec.version') | |
if [[ "$GIT_VERSION" != "v${SPEC_VERSION}" ]]; then | |
echo "Ignoring, git tag version differs from gem spec version." | |
exit 2; | |
fi | |
gem build *.gemspec | |
gem push *.gem |