Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEVOPS-1785] Change ruby publish workflow to use api key method #629

Merged
merged 8 commits into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 23 additions & 16 deletions .github/workflows/publish-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,33 @@ jobs:
cp "temp/${platforms[$i]}/${files[$i]}" "languages/ruby/bitwarden_sdk_secrets/lib/${platforms[$i]}/${files[$i]}"
done

- name: Login to Azure
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

- name: Retrieve secrets
id: retrieve-secrets
uses: bitwarden/gh-actions/get-keyvault-secrets@main
with:
keyvault: "bitwarden-ci"
secrets: "rubygem-api-key"

- name: bundle install
run: bundle install
working-directory: languages/ruby/bitwarden_sdk_secrets

- 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
- name: Build gem
run: gem build bitwarden-sdk-secrets.gemspec
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
- name: Push gem to Rubygems
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem push *.gem
env:
GEM_HOST_API_KEY: ${{ steps.retrieve-secrets.outputs.rubygem-api-key }}
working-directory: languages/ruby/bitwarden_sdk_secrets
Loading