Gem Release #1
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
| # .github/workflows/release.yml | |
| name: Gem Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| ruby: ["3.0", "3.1", "3.2", "3.3"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: oxidize-rb/actions/setup-ruby-and-rust@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: true | |
| - run: bundle exec rake compile | |
| - run: bundle exec rake test | |
| cross-compile: | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: ["x86_64-linux", "aarch64-linux", "x86_64-darwin", "arm64-darwin", "x64-mingw-ucrt"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.1" | |
| - uses: oxidize-rb/actions/cross-gem@v1 | |
| with: | |
| platform: ${{ matrix.platform }} | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: gem-${{ matrix.platform }} | |
| path: pkg/*-${{ matrix.platform }}.gem | |
| release: | |
| needs: cross-compile | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v7 | |
| with: | |
| path: artifacts | |
| - name: Move gems to pkg directory | |
| run: | | |
| mkdir -p pkg | |
| find artifacts -name "*.gem" -exec mv {} pkg/ \; | |
| - name: Publish to RubyGems | |
| env: | |
| RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} | |
| run: | | |
| mkdir -p ~/.gem | |
| echo "--- | |
| :rubygems_api_key: ${RUBYGEMS_API_KEY}" > ~/.gem/credentials | |
| chmod 0600 ~/.gem/credentials | |
| for gem in pkg/*.gem | |
| do | |
| gem push $gem | |
| done |