Skip to content

[deps]: Update clippy_utils digest to bcefe60 - autoclosed #4951

[deps]: Update clippy_utils digest to bcefe60 - autoclosed

[deps]: Update clippy_utils digest to bcefe60 - autoclosed #4951

name: Build @bitwarden/sdk-internal
on:
pull_request:
push:
branches:
- "main"
- "rc"
- "hotfix-rc"
workflow_dispatch:
permissions: {}
defaults:
run:
shell: bash
working-directory: crates/bitwarden-wasm-internal
jobs:
build:
name: Building @bitwarden/sdk-wasm-internal - ${{matrix.license_type.readable}}
runs-on: ubuntu-24.04
permissions:
contents: read
strategy:
matrix:
license_type:
- artifact_name: "sdk-internal"
build_flags: ""
npm_folder: "npm"
readable: "open source license"
- artifact_name: "commercial-sdk-internal"
build_flags: "-b"
npm_folder: "bitwarden_license/npm"
readable: "commercial license"
steps:
- name: Checkout repo
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Set version (PR)
if: ${{ github.event_name == 'pull_request' }}
env:
PR_HEAD_REF: "${{ github.event.pull_request.head.ref }}"
run: |
echo REF_NAME="${PR_HEAD_REF}" >> $GITHUB_ENV
echo SHA="${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
- name: Set env variables (Branch/Tag)
if: ${{ github.event_name == 'push' }}
run: |
echo REF_NAME="${GITHUB_REF_NAME}" >> $GITHUB_ENV
echo SHA="${GITHUB_SHA}" >> $GITHUB_ENV
- name: Set version
run: |
export SDK_VERSION="${REF_NAME} (${SHA:0:7})"
echo "SDK_VERSION='${SDK_VERSION}'" >> $GITHUB_ENV
echo "SDK_VERSION='${SDK_VERSION}'"
- name: Setup Node
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 20
registry-url: "https://npm.pkg.github.com"
cache: "npm"
- name: Install dependencies
run: npm i -g binaryen
- name: Set Rust Toolchain
id: toolchain
shell: bash
run: |
RUST_TOOLCHAIN="$(grep -oP '^channel.*"(\K.*?)(?=")' ../../rust-toolchain.toml)"
echo "RUST_TOOLCHAIN=${RUST_TOOLCHAIN}" | tee -a "${GITHUB_OUTPUT}"
- name: NPM setup
run: npm ci
working-directory: crates/bitwarden-wasm-internal/${{ matrix.license_type.npm_folder }}
- name: Install rust
uses: dtolnay/rust-toolchain@f7ccc83f9ed1e5b9c81d8a67d7ad1a747e22a561 # stable
with:
toolchain: "${{ steps.toolchain.outputs.RUST_TOOLCHAIN }}"
targets: wasm32-unknown-unknown
components: rust-src
- name: Cache cargo registry
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
with:
key: wasm-cargo-cache
- name: Build
run: ./build.sh -r ${{ matrix.license_type.build_flags }}
- name: Upload artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ${{ matrix.license_type.artifact_name }}
path: ${{ github.workspace }}/crates/bitwarden-wasm-internal/${{ matrix.license_type.npm_folder }}/*
if-no-files-found: error
trigger-wasm-publish:
name: Trigger WASM publish
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
needs: build
permissions:
id-token: write
steps:
- name: Log in to Azure
uses: bitwarden/gh-actions/azure-login@main
with:
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
client_id: ${{ secrets.AZURE_CLIENT_ID }}
- name: Get Azure Key Vault secrets
id: get-kv-secrets
uses: bitwarden/gh-actions/get-keyvault-secrets@main
with:
keyvault: gh-org-bitwarden
secrets: "BW-GHAPP-ID,BW-GHAPP-KEY"
- name: Generate GH App token
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
id: app-token
with:
app-id: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-ID }}
private-key: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-KEY }}
owner: bitwarden
repositories: sdk-internal
permission-actions: write
- name: Log out from Azure
uses: bitwarden/gh-actions/azure-logout@main
- name: Trigger WASM publish
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'bitwarden',
repo: 'sdk-internal',
workflow_id: 'publish-wasm-internal.yml',
ref: 'main',
})
trigger-breaking-change-check:
name: Trigger client breaking change checks
if: github.event_name == 'pull_request'
needs: build
permissions:
contents: read
pull-requests: write
id-token: write
uses: ./.github/workflows/detect-breaking-changes.yml
secrets: inherit
with:
pr_number: ${{ github.event.number }}
pr_head_sha: ${{ github.event.pull_request.head.sha }}
pr_head_ref: ${{ github.event.pull_request.head.ref }}
build_run_id: ${{ github.run_id }}
client_repo: "bitwarden/clients"
client_label: "typescript"
client_workflow: "sdk-breaking-change-check.yml"