From 7724d7d073b675eee14ae0924dc128a880071145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Thu, 22 Feb 2024 22:41:49 +0100 Subject: [PATCH] [DEVOPS-1785] Replace Ruby publish composite action with individual steps (#627) ## Type of change ``` - [x] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [x] Build/deploy pipeline (DevOps) - [ ] Other ``` ## Objective Use individual steps instead of composite action for Ruby publish to rubygem.org. Change is needed because the path where the Ruby code lives cannot be specified in `rubygems/release-gem` action. ## Code changes - **.github/workflows/publish-ruby.yml** Use individual steps instead of composite action for Ruby publish to rubygem.org. Change is needed because the path where the Ruby code lives cannot be specified in `rubygems/release-gem` action. - **.github/workflows/build-rust-cross-platform.yml:** Remove `path` in `push` trigger to build always ## Before you submit - Please add **unit tests** where it makes sense to do so --- .../workflows/build-rust-cross-platform.yml | 2 -- .github/workflows/publish-ruby.yml | 23 +++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml index 2eb1d12a8..67c41c6f9 100644 --- a/.github/workflows/build-rust-cross-platform.yml +++ b/.github/workflows/build-rust-cross-platform.yml @@ -8,8 +8,6 @@ on: - main - rc - hotfix-rc - paths: - - "crates/**" jobs: build_rust: diff --git a/.github/workflows/publish-ruby.yml b/.github/workflows/publish-ruby.yml index 6614113cd..498e62812 100644 --- a/.github/workflows/publish-ruby.yml +++ b/.github/workflows/publish-ruby.yml @@ -107,12 +107,27 @@ jobs: for ((i=0; i<${#platforms[@]}; i++)); do cp "temp/${platforms[$i]}/${files[$i]}" "languages/ruby/bitwarden_sdk_secrets/lib/${platforms[$i]}/${files[$i]}" done - shell: bash - name: Build gem run: gem build bitwarden-sdk-secrets.gemspec working-directory: languages/ruby/bitwarden_sdk_secrets - - name: Push gem to Rubygems - if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: rubygems/release-gem@035c7c1c1c14d277318867ced5037926d2395300 # v1.0.1 + - name: Set remote URL + run: | + # Attribute commits to the last committer on HEAD + git config --global user.email "106330231+bitwarden-devops-bot@users.noreply.github.com" + git config --global user.name "bitwarden-devops-bot" + git remote set-url origin "https://x-access-token:${{ github.token }}@github.com/$GITHUB_REPOSITORY" + + - name: Configure trusted publishing credentials + uses: rubygems/configure-rubygems-credentials@bc6dd217f8a4f919d6835fcfefd470ef821f5c44 # v1.0.0 + + - name: Run release rake task + if: ${{ inputs.release_type == 'Release' }} + run: bundle exec rake release + working-directory: languages/ruby/bitwarden_sdk_secrets + + - name: Wait for release to propagate + if: ${{ inputs.release_type == 'Release' }} + run: gem exec rubygems-await pkg/*.gem + working-directory: languages/ruby/bitwarden_sdk_secrets