Skip to content

Release RubyGem

Release RubyGem #52

Workflow file for this run

name: "Release RubyGem"
on:
push:
tags:
- "v*"
branches:
- "release-gem"
jobs:
build:
name: Release cross gems
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-platform:
- arm64-darwin
- x86_64-darwin
- x86_64-linux
- aarch64-linux
- x86_64-linux-musl
- aarch64-linux-musl
steps:
- uses: actions/checkout@v4
- uses: oxidize-rb/actions/setup-ruby-and-rust@v1.1.9
with:
ruby-version: "3.3"
bundler-cache: false
cargo-cache: true
cargo-vendor: true
- uses: oxidize-rb/actions/cross-gem@v1.2.8
with:
platform: ${{ matrix.ruby-platform }}
ruby-versions: "3.3,3.2,3.1"
- uses: actions/upload-artifact@v4
with:
name: bundle-artifact-${{ matrix.ruby-platform }}
path: pkg/
build_source:
name: Build source gem
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oxidize-rb/actions/setup-ruby-and-rust@main
with:
ruby-version: "3.3"
bundler-cache: false
cargo-cache: true
cargo-vendor: true
- name: Build gem
run: |
gem build rucaptcha.gemspec
mkdir -p pkg/
mv *.gem pkg/
- name: Upload Gem
uses: actions/upload-artifact@v4
with:
name: bundle-artifact-source
path: pkg/
publish:
name: Publish cross gems
runs-on: ubuntu-latest
needs:
- build
- build_source
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- uses: actions/download-artifact@v4
with:
pattern: bundle-artifact-*
merge-multiple: true
path: pkg/
- name: Display structure of built gems
run: ls -R pkg/
- name: Publish to RubyGem
env:
RUBYGEM_TOKEN: "${{secrets.RUBYGEM_TOKEN}}"
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${RUBYGEM_TOKEN}\n" > $HOME/.gem/credentials
for filename in pkg/*.gem; do
echo $filename
gem push $filename
done
- name: Install RubyGem & Test Run
run: |
gem install rucaptcha --prerelease --verbose