name: Ruby Gem CI/CD on: push: branches: [ "main" ] pull_request: branches: [ "main" ] jobs: build-and-publish: name: Build and Publish Gem runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Ruby 3.2.2 uses: ruby/setup-ruby@v1 with: ruby-version: '3.2.2' - name: Install dependencies run: bundle install - name: Build Gem run: gem build *.gemspec - name: Push to RubyGems run: | mkdir -p $HOME/.gem touch $HOME/.gem/credentials chmod 0600 $HOME/.gem/credentials printf -- "---\n:rubygems_api_key: ${RUBYGEMS_AUTH_TOKEN}\n" > $HOME/.gem/credentials gem push *.gem env: RUBYGEMS_AUTH_TOKEN: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}