Publish Ruby SDK Release #89
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
setup: | |
name: Setup | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Branch check | |
if: ${{ github.event.inputs.release_type != 'Dry Run' }} | |
run: | | |
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then | |
echo "===================================" | |
echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" | |
echo "===================================" | |
exit 1 | |
fi | |
publish_ruby: | |
name: Publish Ruby | |
runs-on: ubuntu-22.04 | |
needs: setup | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.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: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} | |
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: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} | |
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: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} | |
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: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} | |
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: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} | |
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: 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 "[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: 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 |