You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by er...@apache.org on 2025/08/29 21:13:56 UTC
(opendal) 01/02: feat(bindings/ruby): trust publishing Ruby binding
This is an automated email from the ASF dual-hosted git repository.
erickguan pushed a commit to branch publish-ruby-binding
in repository https://gitbox.apache.org/repos/asf/opendal.git
commit f92098d6bfee0d2a98c9b1e4d86954973a6e4082
Author: Erick Guan <29...@users.noreply.github.com>
AuthorDate: Fri Aug 29 23:11:23 2025 +0200
feat(bindings/ruby): trust publishing Ruby binding
---
.github/workflows/release_ruby.yml | 67 ++++++++++++++++++++++++++++++++++++++
bindings/ruby/Cargo.toml | 1 +
bindings/ruby/Rakefile | 5 +++
bindings/ruby/opendal.gemspec | 7 ++--
4 files changed, 77 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/release_ruby.yml b/.github/workflows/release_ruby.yml
new file mode 100644
index 000000000..5666f492e
--- /dev/null
+++ b/.github/workflows/release_ruby.yml
@@ -0,0 +1,67 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Release Ruby Binding
+
+on:
+ workflow_dispatch: # allow repo collaborators to publish gem
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read # use write if we want `rake release` to push the release tag
+ id-token: write # required for workflow to publish gem
+
+jobs:
+ release:
+ if: github.ref == 'refs/heads/master'
+ runs-on: ubuntu-latest
+
+ defaults:
+ run:
+ working-directory: bindings/ruby
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ # required to run `rake release`.
+ - name: Setup Ruby and install dependencies
+ uses: ruby/setup-ruby@v1
+ with:
+ # setup-ruby implicitly uses .ruby-version
+ bundler-cache: true
+
+ # Run `rake release` to create git tag and push to repository based on `lib/cppjieba_rb/version.rb`.
+ # Then publish the new gem via trusted publishing
+ # Read more on https://guides.rubygems.org/trusted-publishing/releasing-gems/
+ - name: Publish gem
+ uses: rubygems/release-gem@v1
+
+ - name: Create GitHub Release
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ VERSION="v$(bundle exec rake version)"
+
+ gh release create \
+ $VERSION \
+ --verify-tag \
+ --generate-notes \
+ --latest
diff --git a/bindings/ruby/Cargo.toml b/bindings/ruby/Cargo.toml
index e211afdc9..ab52fe72c 100644
--- a/bindings/ruby/Cargo.toml
+++ b/bindings/ruby/Cargo.toml
@@ -25,6 +25,7 @@ homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
rust-version = "1.82"
+version = "0.1.0"
[lib]
crate-type = ["cdylib"]
diff --git a/bindings/ruby/Rakefile b/bindings/ruby/Rakefile
index 90c0977a3..a54b31ea9 100644
--- a/bindings/ruby/Rakefile
+++ b/bindings/ruby/Rakefile
@@ -71,3 +71,8 @@ end
task doc: "doc:default"
task default: %i[clobber compile test standard]
+
+desc 'report gem version'
+task :version do
+ print GEMSPEC.version
+end
diff --git a/bindings/ruby/opendal.gemspec b/bindings/ruby/opendal.gemspec
index 81a6361a8..cfbeb963b 100644
--- a/bindings/ruby/opendal.gemspec
+++ b/bindings/ruby/opendal.gemspec
@@ -39,20 +39,21 @@ Gem::Specification.new do |spec|
spec.summary = "OpenDAL Ruby Binding"
spec.homepage = "https://opendal.apache.org/"
-
- spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
+ spec.license = 'Apache-2.0'
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/apache/opendal"
spec.metadata["changelog_uri"] = "https://github.com/apache/opendal/releases"
+ spec.metadata["rubygems_mfa_required"] = "true"
# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(__dir__) do
`git ls-files -z`.split("\x0").reject do |f|
- (File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor])
+ (File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ .git])
end
end
+
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]