fix(release): use correct version for rubygems credentials action #5
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 | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: ["v*"] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| source-gem: | |
| name: Build source gem | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.4" | |
| bundler-cache: true | |
| - run: bundle exec rake build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: source-gem | |
| path: pkg/*.gem | |
| if-no-files-found: error | |
| cross-compile: | |
| name: Build native gem (${{ matrix.platform }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - x86_64-linux | |
| - aarch64-linux | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.4" | |
| bundler-cache: true | |
| - run: bundle exec rb-sys-dock --ruby-versions 4.0,3.4,3.3 --platform ${{ matrix.platform }} --build | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cross-gem-${{ matrix.platform }} | |
| path: pkg/*.gem | |
| if-no-files-found: error | |
| # arm64-darwin cannot use rb-sys-dock: BoringSSL cross-compilation fails because | |
| # CMake picks up /usr/bin/ld (ELF) instead of the osxcross Mach-O linker. | |
| # No upstream project (wreq, rnet, boring) cross-compiles BoringSSL for Darwin. | |
| native-darwin: | |
| name: Build native gem (arm64-darwin) | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| prefix-key: macos-arm64 | |
| shared-key: release | |
| # Compile per-Ruby-version binaries (matching rb-sys-dock behavior on Linux). | |
| # BoringSSL is compiled once and cached; only rb-sys/magnus rebuild per version. | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3" | |
| bundler-cache: true | |
| - name: Compile for Ruby 3.3 | |
| env: | |
| RB_SYS_CARGO_PROFILE: release | |
| run: | | |
| cargo clean -p rb-sys -p magnus -p serde_magnus -p wreq-ruby --release 2>/dev/null || true | |
| bundle exec rake compile | |
| mkdir -p lib/wreq_ruby/3.3 | |
| cp lib/wreq_ruby/wreq_ruby.bundle lib/wreq_ruby/3.3/ | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.4" | |
| bundler-cache: true | |
| - name: Compile for Ruby 3.4 | |
| env: | |
| RB_SYS_CARGO_PROFILE: release | |
| run: | | |
| cargo clean -p rb-sys -p magnus -p serde_magnus -p wreq-ruby --release | |
| bundle exec rake compile | |
| mkdir -p lib/wreq_ruby/3.4 | |
| cp lib/wreq_ruby/wreq_ruby.bundle lib/wreq_ruby/3.4/ | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "4.0" | |
| bundler-cache: true | |
| - name: Compile for Ruby 4.0 | |
| env: | |
| RB_SYS_CARGO_PROFILE: release | |
| run: | | |
| cargo clean -p rb-sys -p magnus -p serde_magnus -p wreq-ruby --release | |
| bundle exec rake compile | |
| mkdir -p lib/wreq_ruby/4.0 | |
| cp lib/wreq_ruby/wreq_ruby.bundle lib/wreq_ruby/4.0/ | |
| - name: Build platform gem | |
| run: ruby script/build_platform_gem.rb arm64-darwin | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-gem-arm64-darwin | |
| path: pkg/*arm64-darwin*.gem | |
| if-no-files-found: error | |
| smoke-test: | |
| name: Smoke test Linux (Ruby ${{ matrix.ruby }}) | |
| needs: [cross-compile] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby: ["3.3", "3.4", "4.0"] | |
| steps: | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: cross-gem-x86_64-linux | |
| path: pkg/ | |
| - name: Install native gem | |
| run: gem install pkg/wreq-*-x86_64-linux.gem | |
| - name: Verify gem loads and prints version | |
| run: ruby -rwreq -e "puts Wreq::VERSION" | |
| smoke-test-darwin: | |
| name: Smoke test macOS (Ruby ${{ matrix.ruby }}) | |
| needs: [native-darwin] | |
| runs-on: macos-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby: ["3.3", "3.4", "4.0"] | |
| steps: | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: native-gem-arm64-darwin | |
| path: pkg/ | |
| - name: Install native gem | |
| run: gem install pkg/wreq-*-arm64-darwin.gem | |
| - name: Verify gem loads and prints version | |
| run: ruby -rwreq -e "puts Wreq::VERSION" | |
| release: | |
| name: Release | |
| needs: [source-gem, cross-compile, native-darwin, smoke-test, smoke-test-darwin] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.4" | |
| bundler-cache: true | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: pkg/ | |
| pattern: "{cross-gem-*,native-gem-*,source-gem}" | |
| merge-multiple: true | |
| - name: List gems | |
| run: ls -la pkg/*.gem | |
| - name: Verify version matches tag | |
| run: | | |
| GEM_VERSION=$(bundle exec rake version) | |
| if [ "v${GEM_VERSION}" != "${{ github.ref_name }}" ]; then | |
| echo "::error::Gem version v${GEM_VERSION} does not match tag ${{ github.ref_name }}" | |
| exit 1 | |
| fi | |
| - name: Configure trusted publishing credentials | |
| uses: rubygems/configure-rubygems-credentials@v1.0.0 | |
| - name: Push all gems to RubyGems.org | |
| run: | | |
| failed=0 | |
| for gem in pkg/*.gem; do | |
| echo "Pushing $(basename $gem)..." | |
| if ! gem push "$gem"; then | |
| echo "::warning::Failed to push $(basename $gem)" | |
| failed=1 | |
| fi | |
| done | |
| if [ "$failed" -eq 1 ]; then | |
| echo "::error::Some gems failed to push" | |
| exit 1 | |
| fi | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-alpha') || contains(github.ref_name, '-beta') }} |