fix: resolve gem push error with multiple gem files #7
Workflow file for this run
This file contains hidden or 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: Release RubyGem | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Only runs on version tags like v1.0.0 | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' # Or your project's Ruby version | |
| bundler-cache: true | |
| - name: Install dependencies | |
| run: bundle install --jobs 4 --retry 3 | |
| - name: Build the gem | |
| run: gem build *.gemspec | |
| - name: Push to RubyGems | |
| env: | |
| RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} | |
| run: | | |
| mkdir -p ~/.gem | |
| echo -e "---\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials | |
| chmod 0600 ~/.gem/credentials | |
| # Push only the newly built gem (most recent by timestamp) | |
| gem push $(ls -t fastpixapi-*.gem | head -1) |