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] Update release pipeline for ruby sdk #614

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 8 additions & 0 deletions .github/workflows/build-rust-cross-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ name: Build Rust Cross Platform

on:
workflow_call:
workflow_dispatch:
push:
branches:
- main
- rc
- hotfix-rc
paths:
- "crates/**"

jobs:
build_rust:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/generate_schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Generate schemas

on:
workflow_call:
workflow_dispatch:
push:
branches:
- main
- rc
- hotfix-rc

env:
CARGO_TERM_COLOR: always
Expand Down
94 changes: 69 additions & 25 deletions .github/workflows/publish-ruby.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
name: Publish Ruby SDK
run-name: Publish Ruby SDK ${{ inputs.release_type }}

on:
push:
branches:
- main
workflow_dispatch:
inputs:
release_type:
description: "Release Options"
required: true
default: "Release"
type: choice
options:
- Release
- Dry Run

jobs:
generate_schemas:
uses: ./.github/workflows/generate_schemas.yml
setup:
name: Setup
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

build_rust:
uses: ./.github/workflows/build-rust-cross-platform.yml
- 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

build_ruby:
name: Build Ruby
publish_ruby:
name: Publish Ruby
runs-on: ubuntu-22.04
needs:
- generate_schemas
- build_rust
needs: setup
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand All @@ -27,33 +44,60 @@ jobs:
with:
ruby-version: 3.2

- name: Download Ruby schemas artifact
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
- name: Login to Azure
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
with:
name: schemas.rb
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

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

- name: Download artifacts
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: generate_schemas.yml
path: languages/ruby/bitwarden_sdk/lib
workflow_conclusion: success
branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
name: schemas.rb

- name: Download x86_64-apple-darwin files
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
- name: Download x86_64-apple-darwin artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
name: libbitwarden_c_files-x86_64-apple-darwin
workflow: generate_schemas.yml
path: temp/macos-x64
workflow_conclusion: success
branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
name: libbitwarden_c_files-x86_64-apple-darwin

- name: Download aarch64-apple-darwin files
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
- name: Download aarch64-apple-darwin artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: generate_schemas.yml
workflow_conclusion: success
branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
name: libbitwarden_c_files-aarch64-apple-darwin
path: temp/macos-arm64

- name: Download x86_64-unknown-linux-gnu files
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
- name: Download x86_64-unknown-linux-gnu artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: generate_schemas.yml
workflow_conclusion: success
branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
name: libbitwarden_c_files-x86_64-unknown-linux-gnu
path: temp/linux-x64

- name: Download x86_64-pc-windows-msvc files
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
- name: Download x86_64-pc-windows-msvc artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
workflow: generate_schemas.yml
workflow_conclusion: success
branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
name: libbitwarden_c_files-x86_64-pc-windows-msvc
path: temp/windows-x64

Expand Down Expand Up @@ -84,5 +128,5 @@ jobs:
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem push *.gem
env:
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
GEM_HOST_API_KEY: ${{ steps.retrieve-secret.outputs.ruby-gem-api-key }}
working-directory: languages/ruby/bitwarden_sdk
6 changes: 6 additions & 0 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
- cli
- napi
- python-sdk
- ruby-sdk
version_number:
description: "New version (example: '2024.1.0')"
required: true
Expand Down Expand Up @@ -150,6 +151,11 @@ jobs:
sed -i 's/version = "[0-9]\.[0-9]\.[0-9]"/version = "${{ inputs.version_number }}"/' ./languages/python/pyproject.toml
sed -i 's/__version__ = "[0-9]\.[0-9]\.[0-9]"/__version__ = "${{ inputs.version_number }}"/' ./languages/python/bitwarden_sdk/__init__.py

### ruby sdk
- name: Bump ruby-sdk Version
if: ${{ inputs.project == 'ruby-sdk' }}
run: sed -i "s/VERSION = '[0-9]\.[0-9]\.[0-9]'/VERSION = '${{ inputs.version_number }}'/" ./languages/ruby/bitwarden_sdk/lib/version.rb

############################
# VERSION BUMP SECTION END #
############################
Expand Down
Loading