Skip to content

Commit

Permalink
Simplify logic and apply linting suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrassia committed Sep 17, 2024
1 parent 74a9e30 commit 1df1044
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions .github/workflows/publish-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,23 @@ permissions:
id-token: write

jobs:
setup:
name: Setup
publish_ruby:
name: Publish Ruby
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Branch check
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
if: ${{ inputs.release_type != 'Dry Run' }}
run: |
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then
if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then
echo "==================================="
echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches"
echo "[!] Can only release from the 'main' branch"
echo "==================================="
exit 1
fi
publish_ruby:
name: Publish Ruby
runs-on: ubuntu-22.04
needs: setup
steps:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Ruby
uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1.191.0
with:
Expand All @@ -54,7 +46,7 @@ jobs:
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 }}
branch: main
artifacts: schemas.rb

- name: Download x86_64-apple-darwin artifact
Expand All @@ -63,15 +55,15 @@ jobs:
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 }}
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: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
branch: main
artifacts: libbitwarden_c_files-aarch64-apple-darwin
path: temp/macos-arm64

Expand All @@ -80,7 +72,7 @@ jobs:
with:
workflow: build-rust-cross-platform.yml
workflow_conclusion: success
branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
branch: main
artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu
path: temp/linux-x64

Expand All @@ -89,7 +81,7 @@ jobs:
with:
workflow: build-rust-cross-platform.yml
workflow_conclusion: success
branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'main' || github.ref_name }}
branch: main
artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc
path: temp/windows-x64

Expand Down Expand Up @@ -128,6 +120,7 @@ jobs:
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
Expand Down

0 comments on commit 1df1044

Please sign in to comment.