Skip to content

Commit

Permalink
Use rubygem api key to publish
Browse files Browse the repository at this point in the history
  • Loading branch information
michalchecinski committed Feb 23, 2024
1 parent 27ec020 commit d920daf
Showing 1 changed file with 39 additions and 15 deletions.
54 changes: 39 additions & 15 deletions .github/workflows/publish-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,50 @@ 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
- name: Push gem to Rubygems
run: |
# Attribute commits to the last committer on HEAD
git config --global user.email "[email protected]"
git config --global user.name "bitwarden-devops-bot"
git remote set-url origin "https://x-access-token:${{ github.token }}@github.com/$GITHUB_REPOSITORY"
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

- name: Configure trusted publishing credentials
uses: rubygems/configure-rubygems-credentials@bc6dd217f8a4f919d6835fcfefd470ef821f5c44 # v1.0.0
# - name: Set remote URL
# run: |
# # Attribute commits to the last committer on HEAD
# git config --global user.email "[email protected]"
# git config --global user.name "bitwarden-devops-bot"
# git remote set-url origin "https://x-access-token:${{ github.token }}@github.com/$GITHUB_REPOSITORY"

- name: Run release rake task
if: ${{ inputs.release_type == 'Release' }}
run: bundle exec rake release
working-directory: languages/ruby/bitwarden_sdk_secrets
# - 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

- 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

0 comments on commit d920daf

Please sign in to comment.