From b4ca0933510029ec2c6882074cc9a08e2de1c592 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Tue, 9 Jan 2024 15:33:58 +0100 Subject: [PATCH] fix(ruby): release using Trusted Publishing (#2504) --- .../.github/workflows/release.yml | 9 ++++----- scripts/ci/codegen/spreadGeneration.ts | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clients/algoliasearch-client-ruby/.github/workflows/release.yml b/clients/algoliasearch-client-ruby/.github/workflows/release.yml index 09078eeb1a..b50b460ab4 100644 --- a/clients/algoliasearch-client-ruby/.github/workflows/release.yml +++ b/clients/algoliasearch-client-ruby/.github/workflows/release.yml @@ -1,5 +1,7 @@ name: Release +# This file is registered in https://rubygems.org/gems/algolia/trusted_publishers to be able to publish new versions of the gem. + on: push: branches: @@ -12,6 +14,7 @@ jobs: if: "startsWith(github.event.head_commit.message, 'chore: release')" permissions: id-token: write + contents: write steps: - uses: actions/checkout@v4 @@ -21,8 +24,4 @@ jobs: ruby-version: 3.2.2 bundler-cache: true - - name: Build gem - run: gem build algolia.gemspec - - - name: Publish new gem - run: gem push --key ${{ secrets.RUBYGEMS_API_KEY }} $(ls algolia-*.gem) + - uses: rubygems/release-gem@v1 diff --git a/scripts/ci/codegen/spreadGeneration.ts b/scripts/ci/codegen/spreadGeneration.ts index 9e1adea970..a5f264db1f 100644 --- a/scripts/ci/codegen/spreadGeneration.ts +++ b/scripts/ci/codegen/spreadGeneration.ts @@ -107,7 +107,8 @@ async function spreadGeneration(): Promise { await run('git push', { cwd: tempGitDir }); // In case of a release commit, we also want to update tags on the clients repositories - if (IS_RELEASE_COMMIT) { + // ruby tag is already pushed by `rake release` + if (IS_RELEASE_COMMIT && lang !== 'ruby') { // Go needs a 'v' prefix for tags. const tagVersion = lang === 'go' ? `v${version}` : version;