From c22a64af99bab5c062a41c4d0eed346376906b37 Mon Sep 17 00:00:00 2001 From: Kirill Mokevnin Date: Fri, 26 Jun 2026 13:05:51 +0300 Subject: [PATCH] ci: migrate off Stainless to release-please publishing Stainless wound down its hosted SDK generator, so this gem is now hand-maintained and its Stainless-driven CI/release plumbing is dead. - Drop the Stainless build job and codegen/stl-preview branch plumbing from ci.yml; lint and test now run on normal pushes to main and on PRs. - Add release.yml with the release-please + gated publish pattern (same as hexlet-ide): the publish job runs in the same workflow invocation that cuts the release, so no GITHUB_TOKEN cascade or PAT is needed. - Reduce publish-gem.yml to a manual workflow_dispatch fallback. - Retarget release-please-config.json from the Stainless fork to the official schema, dropping prerelease mode and the Stainless-only ruby-readme updater in favor of the standard generic README updater. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/ci.yml | 56 ++----------------------------- .github/workflows/publish-gem.yml | 10 +++--- .github/workflows/release.yml | 50 +++++++++++++++++++++++++++ release-please-config.json | 6 ++-- 4 files changed, 59 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44343c5..b3be887 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,63 +2,14 @@ name: CI on: push: branches: - - '**' - - '!integrated/**' - - '!stl-preview-head/**' - - '!stl-preview-base/**' - - '!generated' - - '!codegen/**' - - 'codegen/stl/**' + - main pull_request: - branches-ignore: - - 'stl-preview-head/**' - - 'stl-preview-base/**' jobs: - build: - timeout-minutes: 10 - name: build - permissions: - contents: read - id-token: write - runs-on: ${{ github.repository == 'stainless-sdks/docker-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: |- - github.repository == 'stainless-sdks/docker-ruby' && - (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') - steps: - - uses: actions/checkout@v6 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: false - - run: |- - bundle install - - - name: Get GitHub OIDC Token - if: |- - github.repository == 'stainless-sdks/docker-ruby' && - !startsWith(github.ref, 'refs/heads/stl/') - id: github-oidc - uses: actions/github-script@v8 - with: - script: core.setOutput('github_token', await core.getIDToken()); - - - name: Build and upload gem artifacts - if: |- - github.repository == 'stainless-sdks/docker-ruby' && - !startsWith(github.ref, 'refs/heads/stl/') - env: - URL: https://pkg.stainless.com/s - AUTH: ${{ steps.github-oidc.outputs.github_token }} - SHA: ${{ github.sha }} - PACKAGE_NAME: docker_engine_ruby - run: ./scripts/utils/upload-artifact.sh lint: timeout-minutes: 10 name: lint - runs-on: ${{ github.repository == 'stainless-sdks/docker-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork - + runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Set up Ruby @@ -73,8 +24,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: ${{ github.repository == 'stainless-sdks/docker-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Set up Ruby diff --git a/.github/workflows/publish-gem.yml b/.github/workflows/publish-gem.yml index 99a2a84..9529604 100644 --- a/.github/workflows/publish-gem.yml +++ b/.github/workflows/publish-gem.yml @@ -1,13 +1,11 @@ -# This workflow is triggered when a GitHub release is created. -# It can also be run manually to re-publish to rubygems.org in case it failed for some reason. -# You can run this workflow by navigating to https://www.github.com/Hexlet/docker-ruby/actions/workflows/publish-gem.yml +# Manual fallback to (re-)publish a gem version to rubygems.org. +# The normal release flow publishes from the `release.yml` workflow's `publish` job. +# Run this manually only if that publish step needs to be retried for an existing release. +# Navigate to the Actions tab -> Publish Gem -> Run workflow. name: Publish Gem on: workflow_dispatch: - release: - types: [published] - jobs: publish: name: publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..21e7fce --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,50 @@ +name: Release Please + +on: + push: + branches: + - main + +jobs: + release-please: + runs-on: ubuntu-latest + if: github.repository == 'Hexlet/docker-ruby' + + permissions: + contents: write + pull-requests: write + + outputs: + release_created: ${{ steps.release.outputs.release_created }} + version: ${{ steps.release.outputs.tag_name }} + + steps: + - uses: googleapis/release-please-action@v5 + id: release + with: + token: ${{ secrets.GITHUB_TOKEN }} + config-file: release-please-config.json + manifest-file: .release-please-manifest.json + + publish: + needs: release-please + if: needs.release-please.outputs.release_created == 'true' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: false + + - run: |- + bundle install + + - name: Publish to RubyGems.org + run: bash ./bin/publish-gem + env: + # `RUBYGEMS_HOST` is only required for private gem repositories, not https://rubygems.org + RUBYGEMS_HOST: ${{ secrets.DOCKER_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }} + GEM_HOST_API_KEY: ${{ secrets.DOCKER_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }} diff --git a/release-please-config.json b/release-please-config.json index fe8c31f..b166311 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -2,11 +2,9 @@ "packages": { ".": {} }, - "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", "include-v-in-tag": true, "include-component-in-tag": false, - "versioning": "prerelease", - "prerelease": true, "bump-minor-pre-major": true, "bump-patch-for-minor-pre-major": false, "pull-request-header": "Automated Release PR", @@ -63,7 +61,7 @@ "version-file": "lib/docker_engine_ruby/version.rb", "extra-files": [ { - "type": "ruby-readme", + "type": "generic", "path": "README.md" } ]