Skip to content

Publish Ruby SDK Release #99

Publish Ruby SDK Release

Publish Ruby SDK Release #99

Workflow file for this run

name: Publish Ruby SDK
run-name: Publish Ruby SDK ${{ inputs.release_type }}
on:
workflow_dispatch:
inputs:
release_type:
description: "Release Options"
required: true
default: "Release"
type: choice
options:
- Release
- Dry Run
permissions:
contents: read
id-token: write
jobs:
publish_ruby:
name: Publish Ruby
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: main
- name: Set up Ruby
uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1.191.0
with:
ruby-version: 3.2
- name: Download artifacts
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: generate_schemas.yml
path: languages/ruby/bitwarden_sdk_secrets/lib
workflow_conclusion: success
branch: main
artifacts: schemas.rb
- name: Download x86_64-apple-darwin artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: build-rust-cross-platform.yml
path: temp/macos-x64
workflow_conclusion: success
branch: main
artifacts: libbitwarden_c_files-x86_64-apple-darwin
- name: Download aarch64-apple-darwin artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: build-rust-cross-platform.yml
workflow_conclusion: success
branch: main
artifacts: libbitwarden_c_files-aarch64-apple-darwin
path: temp/macos-arm64
- name: Download x86_64-unknown-linux-gnu artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: build-rust-cross-platform.yml
workflow_conclusion: success
branch: main
artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu
path: temp/linux-x64
- name: Download x86_64-pc-windows-msvc artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: build-rust-cross-platform.yml
workflow_conclusion: success
branch: main
artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc
path: temp/windows-x64
- name: Copy lib files
run: |
mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/macos-arm64
mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/linux-x64
mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/macos-x64
mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/windows-x64
platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64")
files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll")
for ((i=0; i<${#platforms[@]}; i++)); do
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: Build gem
run: gem build bitwarden-sdk-secrets.gemspec
working-directory: languages/ruby/bitwarden_sdk_secrets
- name: Push gem to Rubygems
if: ${{ inputs.release_type != 'Dry Run' }}
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