Skip to content

[PM-40277] Key rotation corrupts attachments, fido2 credentials #7365

[PM-40277] Key rotation corrupts attachments, fido2 credentials

[PM-40277] Key rotation corrupts attachments, fido2 credentials #7365

Workflow file for this run

name: Build Swift Package
on:
pull_request:
push:
branches:
- "rc"
- "hotfix-rc"
- "main"
workflow_dispatch:
jobs:
version:
name: Get Version
runs-on: ubuntu-24.04
permissions:
contents: read
outputs:
package_version: ${{ steps.retrieve-version.outputs.package_version }}
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Get Package Version
id: retrieve-version
run: |
VERSION=$(grep -o '^version = ".*"' Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")
echo "package_version=$VERSION" >> $GITHUB_OUTPUT
build:
name: Build
runs-on: macos-14
needs: version
permissions:
contents: read
env:
_VERSION: ${{ needs.version.outputs.package_version }}
outputs:
short-sha: ${{ steps.build.outputs.short-sha }}
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Install rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
toolchain: stable
- name: Cache cargo registry
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
with:
key: sdk-swift-cargo
- name: Rustup target
run: |
rustup target install aarch64-apple-ios-sim
rustup target install aarch64-apple-ios
rustup target install x86_64-apple-ios
- name: Build
shell: bash
working-directory: crates/bitwarden-uniffi/swift
id: build
run: |
./build.sh
# SHA Short
echo "short-sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Test build demo app
working-directory: crates/bitwarden-uniffi/swift/iOS
run: |
xcodebuild clean build \
-project App.xcodeproj \
-scheme App \
-destination generic/platform=iOS \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO
- name: Zip BitwardenFFI.xcframework
run: |
mkdir artifacts
cp -rf crates/bitwarden-uniffi/swift/BitwardenFFI.xcframework artifacts
- name: Upload BitwardenFFI.xcframework artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: BitwardenFFI-${{ env._VERSION }}-${{ steps.build.outputs.short-sha }}.xcframework
path: artifacts
if-no-files-found: error
- name: Upload BitwardenSdk sources
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: BitwardenSdk-${{ env._VERSION }}-${{ steps.build.outputs.short-sha }}-sources
path: crates/bitwarden-uniffi/swift/Sources/BitwardenSdk
if-no-files-found: error
integration-tests:
name: Integration tests
runs-on: macos-14
needs: [version, build]
permissions:
contents: read
env:
_VERSION: ${{ needs.version.outputs.package_version }}
_SHORT_SHA: ${{ needs.build.outputs.short-sha }}
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Download BitwardenFFI.xcframework
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: BitwardenFFI-${{ env._VERSION }}-${{ env._SHORT_SHA }}.xcframework
path: crates/bitwarden-uniffi/swift
- name: Download generated BitwardenSdk sources
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: BitwardenSdk-${{ env._VERSION }}-${{ env._SHORT_SHA }}-sources
path: crates/bitwarden-uniffi/swift/Sources/BitwardenSdk
- name: Run integration tests
working-directory: crates/bitwarden-uniffi/swift/integration-tests
run: |
DEVICE_ID=$(xcrun simctl list devices available | awk -F '[()]' '/iPhone/{print $2; exit}')
xcodebuild test \
-scheme IntegrationTests-Package \
-destination "id=$DEVICE_ID" \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
trigger-swift-release:
name: Trigger Swift release
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
needs: build
permissions:
actions: write
steps:
- name: Trigger Swift release
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'bitwarden',
repo: 'sdk-internal',
workflow_id: 'release-swift.yml',
ref: 'main',
inputs: {
'build-run-id': '${{ github.run_id }}',
'build-run-number': '${{ github.run_number }}',
'sdk-swift-branch-name': 'unstable',
'update-ios-repo': 'true',
}
})