From f9faf2760bd888744ce941d5946c4c7f911ead35 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:11:52 +0000 Subject: [PATCH 1/5] Plan workflows for RubyGems release and deployment Agent-Logs-Url: https://github.com/niwo/cloudstack_client/sessions/6e43498d-ff8d-4991-82bf-c21abfa5113b Co-authored-by: niwo <57439+niwo@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c5b00a2..e1478d5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - cloudstack_client (1.5.11) + cloudstack_client (1.5.12) GEM remote: https://rubygems.org/ From 668d8c106a4a1470414ea0d36f6c36dc8830b9d0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:12:42 +0000 Subject: [PATCH 2/5] Add GitHub Actions CI and RubyGems release workflows Agent-Logs-Url: https://github.com/niwo/cloudstack_client/sessions/6e43498d-ff8d-4991-82bf-c21abfa5113b Co-authored-by: niwo <57439+niwo@users.noreply.github.com> --- .github/workflows/ci.yml | 29 ++++++++++++++++++++ .github/workflows/release.yml | 51 +++++++++++++++++++++++++++++++++++ README.md | 13 +++++++++ 3 files changed, 93 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2acc738 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby-version: ['3.2', '3.3', '3.4'] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: Run tests + run: bundle exec rake test + + - name: Build gem + run: bundle exec rake build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e06c376 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Release + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + verify: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + bundler-cache: true + + - name: Run tests + run: bundle exec rake test + + - name: Build gem + run: bundle exec rake build + + publish: + runs-on: ubuntu-latest + needs: verify + environment: rubygems + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + bundler-cache: true + + - name: Build gem + run: bundle exec rake build + + - name: Publish gem to RubyGems + env: + RUBYGEMS_AUTH_TOKEN: ${{ secrets.RUBYGEMS_AUTH_TOKEN }} + run: gem push "$(ls pkg/*.gem | sort | tail -n 1)" diff --git a/README.md b/README.md index 48b6149..df88f11 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,19 @@ $ cloudstack_client list_apis > data/4.15.json $ gzip data/4.15.json ``` +### GitHub Actions + +This repository includes GitHub Actions workflows for: + +- Running tests and gem build on every push and pull request (`CI`) +- Publishing the gem to RubyGems when a GitHub Release is published (`Release`) + +To enable publishing, add this repository secret: + +- `RUBYGEMS_AUTH_TOKEN`: your RubyGems API key with push permissions + +The release workflow uses the `rubygems` environment and pushes the built gem automatically. + ## References - [Apache CloudStack API documentation](http://cloudstack.apache.org/api/apidocs-4.15/) From 8a574fa6ba19024644c9e7cc950f962fc854d1fd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:14:01 +0000 Subject: [PATCH 3/5] Address validation feedback for release workflow Agent-Logs-Url: https://github.com/niwo/cloudstack_client/sessions/6e43498d-ff8d-4991-82bf-c21abfa5113b Co-authored-by: niwo <57439+niwo@users.noreply.github.com> --- .github/workflows/ci.yml | 3 +++ .github/workflows/release.yml | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2acc738..150cc69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,9 @@ on: push: pull_request: +permissions: + contents: read + jobs: test: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e06c376..e030f79 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,9 @@ on: types: [published] workflow_dispatch: +permissions: + contents: read + jobs: verify: runs-on: ubuntu-latest @@ -29,8 +32,6 @@ jobs: runs-on: ubuntu-latest needs: verify environment: rubygems - permissions: - contents: read steps: - name: Checkout repository @@ -46,6 +47,6 @@ jobs: run: bundle exec rake build - name: Publish gem to RubyGems - env: - RUBYGEMS_AUTH_TOKEN: ${{ secrets.RUBYGEMS_AUTH_TOKEN }} - run: gem push "$(ls pkg/*.gem | sort | tail -n 1)" + uses: rubygems/release-gem@v1 + with: + api-key: ${{ secrets.RUBYGEMS_AUTH_TOKEN }} From f91d0e7f45de31a6abea269e97c0ed41787852a5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:14:52 +0000 Subject: [PATCH 4/5] Enforce version bump before release build Agent-Logs-Url: https://github.com/niwo/cloudstack_client/sessions/6e43498d-ff8d-4991-82bf-c21abfa5113b Co-authored-by: niwo <57439+niwo@users.noreply.github.com> --- .github/workflows/release.yml | 12 +++++++++--- README.md | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e030f79..ddb89cd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,15 @@ jobs: - name: Run tests run: bundle exec rake test + - name: Ensure version is bumped + run: | + CURRENT_VERSION="$(ruby -Ilib -e "require 'cloudstack_client/version'; puts CloudstackClient::VERSION")" + LATEST_JSON="$(curl -fsSL https://rubygems.org/api/v1/versions/cloudstack_client/latest.json || true)" + if [ -n "$LATEST_JSON" ]; then + LATEST_VERSION="$(printf '%s' "$LATEST_JSON" | ruby -rjson -e "puts JSON.parse(STDIN.read)['version']")" + ruby -e "require 'rubygems/version'; current = Gem::Version.new('$CURRENT_VERSION'); latest = Gem::Version.new('$LATEST_VERSION'); abort(\"Version must be bumped before building (current=#{current}, latest=#{latest})\") unless current > latest" + fi + - name: Build gem run: bundle exec rake build @@ -43,9 +52,6 @@ jobs: ruby-version: '3.2' bundler-cache: true - - name: Build gem - run: bundle exec rake build - - name: Publish gem to RubyGems uses: rubygems/release-gem@v1 with: diff --git a/README.md b/README.md index df88f11..d76fc81 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,7 @@ To enable publishing, add this repository secret: - `RUBYGEMS_AUTH_TOKEN`: your RubyGems API key with push permissions -The release workflow uses the `rubygems` environment and pushes the built gem automatically. +The release workflow checks that `CloudstackClient::VERSION` is greater than the latest version on RubyGems before building, then uses the `rubygems` environment to publish. ## References From 5bcd6620ed9c0ac9169d0547d1539a749cd52c48 Mon Sep 17 00:00:00 2001 From: Nik Wolfgramm Date: Wed, 15 Apr 2026 23:26:48 +0200 Subject: [PATCH 5/5] Remove Ruby version 3.4 from CI matrix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 150cc69..41867f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - ruby-version: ['3.2', '3.3', '3.4'] + ruby-version: ['3.2', '3.3'] steps: - name: Checkout repository