Skip to content

SM-1287: Return eyre in secrets edit if no project id exists #52

SM-1287: Return eyre in secrets edit if no project id exists

SM-1287: Return eyre in secrets edit if no project id exists #52

---

Check failure on line 1 in .github/workflows/publish-rust-crates.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish-rust-crates.yml

Invalid workflow file

you may only define up to 10 `inputs` for a `workflow_dispatch` event
name: Publish Rust crates
run-name: Publish Rust crates ${{ inputs.release_type }}
on:
workflow_dispatch:
inputs:
release_type:
description: "Release Options"
required: true
default: "Initial Release"
type: choice
options:
- Initial Release
- Redeploy
- Dry Run
publish_bitwarden:
description: "Publish bitwarden crate"
required: true
default: true
type: boolean
publish_bitwarden-api-api:
description: "Publish bitwarden-api-api crate"
required: true
default: true
type: boolean
publish_bitwarden-api-identity:
description: "Publish bitwarden-api-identity crate"
required: true
default: true
type: boolean
publish_bitwarden-core:
description: "Publish bitwarden-core crate"
required: true
default: true
type: boolean
publish_bitwarden-crypto:
description: "Publish bitwarden-crypto crate"
required: true
default: true
type: boolean
publish_bitwarden-cli:
description: "Publish bitwarden-cli crate"
required: true
default: true
type: boolean
publish_bitwarden-exporters:
description: "Publish bitwarden-exporters crate"
required: true
default: true
type: boolean
publish_bitwarden-fido:
description: "Publish bitwarden-fido crate"
required: true
default: true
type: boolean
publish_bitwarden-generators:
description: "Publish bitwarden-generators crate"
required: true
default: true
type: boolean
publish_bitwarden-send:
description: "Publish bitwarden-send crate"
required: true
default: true
type: boolean
publish_bitwarden-vault:
description: "Publish bitwarden-valt crate"
required: true
default: true
type: boolean
defaults:
run:
shell: bash
jobs:
setup:
name: Setup
runs-on: ubuntu-22.04
outputs:
packages_list: ${{ steps.packages-list.outputs.packages_list }}
packages_command: ${{ steps.packages-list.outputs.packages_command }}
steps:
- name: Checkout repo
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- 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
- name: Prepare packages list
id: packages-list
env:
PUBLISH_BITWARDEN: ${{ github.event.inputs.publish_bitwarden }}
PUBLISH_BITWARDEN_API_API: ${{ github.event.inputs.publish_bitwarden-api-api }}
PUBLISH_BITWARDEN_API_IDENTITY: ${{ github.event.inputs.publish_bitwarden-api-identity }}
PUBLISH_BITWARDEN_CORE: ${{ github.event.inputs.publish_bitwarden-core }}
PUBLISH_BITWARDEN_CRYPTO: ${{ github.event.inputs.publish_bitwarden-crypto }}
PUBLISH_BITWARDEN_CLI: ${{ github.event.inputs.publish_bitwarden-cli }}
PUBLISH_BITWARDEN_EXPORTERS: ${{ github.event.inputs.publish_bitwarden-exporters }}
PUBLISH_BITWARDEN_FIDO: ${{ github.event.inputs.publish_bitwarden-fido }}
PUBLISH_BITWARDEN_GENERATORS: ${{ github.event.inputs.publish_bitwarden-generators }}
PUBLISH_BITWARDEN_SEND: ${{ github.event.inputs.publish_bitwarden-send }}
PUBLISH_BITWARDEN_VAULT: ${{ github.event.inputs.publish_bitwarden-vault }}
run: |
if [[ "$PUBLISH_BITWARDEN" == "false" ]] && [[ "$PUBLISH_BITWARDEN_API_API" == "false" ]] && [[ "$PUBLISH_BITWARDEN_API_IDENTITY" == "false" ]]; then
echo "==================================="
echo "[!] You need to specify at least one crate for release!"
echo "==================================="
exit 1
fi
PACKAGES_COMMAND=""
PACKAGES_LIST=""
if [[ "$PUBLISH_BITWARDEN" == "true" ]] ; then
PACKAGES_COMMAND="$PACKAGES_COMMAND -p bitwarden"
PACKAGES_LIST="$PACKAGES_LIST bitwarden"
fi
if [[ "$PUBLISH_BITWARDEN_API_API" == "true" ]]; then
PACKAGES_COMMAND="$PACKAGES_COMMAND -p bitwarden-api-api"
PACKAGES_LIST="$PACKAGES_LIST bitwarden-api-api"
fi
if [[ "$PUBLISH_BITWARDEN_API_IDENTITY" == "true" ]]; then
PACKAGES_COMMAND="$PACKAGES_COMMAND -p bitwarden-api-identity"
PACKAGES_LIST="$PACKAGES_LIST bitwarden-api-identity"
fi
if [[ "$PUBLISH_BITWARDEN_CORE" == "true" ]]; then
PACKAGES_COMMAND="$PACKAGES_COMMAND -p bitwarden-core"
PACKAGES_LIST="$PACKAGES_LIST bitwarden-core"
fi
if [[ "$PUBLISH_BITWARDEN_CRYPTO" == "true" ]]; then
PACKAGES_COMMAND="$PACKAGES_COMMAND -p bitwarden-crypto"
PACKAGES_LIST="$PACKAGES_LIST bitwarden-crypto"
fi
if [[ "$PUBLISH_BITWARDEN_CLI" == "true" ]]; then
PACKAGES_COMMAND="$PACKAGES_COMMAND -p bitwarden-cli"
PACKAGES_LIST="$PACKAGES_LIST bitwarden-cli"
fi
if [[ "$PUBLISH_BITWARDEN_EXPORTERS" == "true" ]]; then
PACKAGES_COMMAND="$PACKAGES_COMMAND -p bitwarden-exporters"
PACKAGES_LIST="$PACKAGES_LIST bitwarden-exporters"
fi
if [[ "$PUBLISH_BITWARDEN_FIDO" == "true" ]]; then
PACKAGES_COMMAND="$PACKAGES_COMMAND -p bitwarden-fido"
PACKAGES_LIST="$PACKAGES_LIST bitwarden-fido"
fi
if [[ "$PUBLISH_BITWARDEN_GENERATORS" == "true" ]]; then
PACKAGES_COMMAND="$PACKAGES_COMMAND -p bitwarden-generators"
PACKAGES_LIST="$PACKAGES_LIST bitwarden-generators"
fi
if [[ "$PUBLISH_BITWARDEN_SEND" == "true" ]]; then
PACKAGES_COMMAND="$PACKAGES_COMMAND -p bitwarden-send"
PACKAGES_LIST="$PACKAGES_LIST bitwarden-send"
fi
if [[ "$PUBLISH_BITWARDEN_VAULT" == "true" ]]; then
PACKAGES_COMMAND="$PACKAGES_COMMAND -p bitwarden-vault"
PACKAGES_LIST="$PACKAGES_LIST bitwarden-vault"
fi
echo "Packages command: " $PACKAGES_COMMAND
echo "Packages list: " $PACKAGES_LIST
echo "packages_list=$PACKAGES_LIST" >> $GITHUB_OUTPUT
echo "packages_command=$PACKAGES_COMMAND" >> $GITHUB_OUTPUT
publish:
name: Publish ${{ needs.setup.outputs.packages_list }}
runs-on: ubuntu-latest
needs:
- setup
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- 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: "cratesio-api-token"
- name: Install rust
uses: dtolnay/rust-toolchain@d8352f6b1d2e870bc5716e7a6d9b65c4cc244a1a # stable
with:
toolchain: stable
- name: Cache cargo registry
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- name: Install cargo-release
run: cargo install cargo-release
- name: Create GitHub deployment
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7
id: deployment
with:
token: "${{ secrets.GITHUB_TOKEN }}"
initial-status: "in_progress"
environment: "Bitwarden SDK to crates.io: ${{ needs.setup.outputs.packages_list }}"
description: "Deployment from branch ${{ github.ref_name }}"
task: release
- name: Cargo release
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
env:
PUBLISH_GRACE_SLEEP: 10
PACKAGES_PUBLISH: ${{ needs.setup.outputs.packages_command }}
CARGO_REGISTRY_TOKEN: ${{ steps.retrieve-secrets.outputs.cratesio-api-token }}
run: cargo-release release publish $PACKAGES_PUBLISH --execute --no-confirm
- name: Update deployment status to Success
if: ${{ github.event.inputs.release_type != 'Dry Run' && success() }}
uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3
with:
token: "${{ secrets.GITHUB_TOKEN }}"
state: "success"
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
- name: Update deployment status to Failure
if: ${{ github.event.inputs.release_type != 'Dry Run' && failure() }}
uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3
with:
token: "${{ secrets.GITHUB_TOKEN }}"
state: "failure"
deployment-id: ${{ steps.deployment.outputs.deployment_id }}