Skip to content

Tag on Github and Release to RubyGems #5

Tag on Github and Release to RubyGems

Tag on Github and Release to RubyGems #5

Workflow file for this run

---
name: Tag on Github and Release to RubyGems
on: [workflow_dispatch]
jobs:
release:
name: Release to RubyGems
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Tag on Github
run: |
VERSION=$(ruby -e "puts Gem::Specification::load('datatrans.gemspec').version")
echo "v$VERSION"
git tag "v$VERSION"
git push origin "v$VERSION"
- name: Publish to RubyGems
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
env:
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}