From 378e04d947999b52c8435cfae9e3cfb88a45caed Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Mon, 18 Sep 2023 11:31:26 -0600 Subject: [PATCH 01/31] Add initial workflow --- .github/workflows/build-swift.yml | 145 ++++++++++++++++++++++++++++ .github/workflows/release-swift.yml | 71 ++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 .github/workflows/build-swift.yml create mode 100644 .github/workflows/release-swift.yml diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml new file mode 100644 index 000000000..5ad707522 --- /dev/null +++ b/.github/workflows/build-swift.yml @@ -0,0 +1,145 @@ +--- +name: Build Swift Package + +on: + push: + branches: + - "rc" + - "hotfix-rc-swift" + paths: + - "languages/swift/**" + +jobs: + version: + name: Get Version + runs-on: ubuntu-22.04 + outputs: + package_version: ${{ steps.retrieve-version.outputs.package_version }} + steps: + - name: Checkout repo + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + + - name: Get Package Version + id: retrieve-version + run: | + VERSION=$(grep -o '^version = ".*"' crates/bitwarden/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") + echo "package_version=$VERSION" >> $GITHUB_OUTPUT + + + build: + runs-on: macos-13 + strategy: + fail-fast: false + matrix: + settings: + - target: aarch64-apple-ios-sim + - target: aarch64-apple-ios + - target: x86_64-apple-ios + steps: + - name: Checkout repo + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + + - name: Install rust + uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + with: + toolchain: 1.70.0 + + - name: Cache cargo registry + uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0 + with: + key: ${{ matrix.settings.target }}-cargo + + - name: Rustup target + run: rustup target install ${{ matrix.settings.target }} + + - name: Build native library + env: + IPHONEOS_DEPLOYMENT_TARGET: 13.0 + RUSTFLAGS: "-C link-arg=-Wl,-application_extension" + run: cargo build --package bitwarden-uniffi --target ${{ matrix.settings.target }} --release + working-directory: languages/swift + + - name: Upload libbitwarden_uniffi.a artifact + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + with: + name: libbitwarden_uniffi.a-${{ matrix.settings.target }} + path: ./target/${{ matrix.settings.target }}/release/libbitwarden_uniffi.a + if-no-files-found: error + + - name: Upload libbitwarden_uniffi.dylib artifact + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + with: + name: libbitwarden_uniffi.dylib-${{ matrix.settings.target }} + path: ./target/${{ matrix.settings.target }}/release/libbitwarden_uniffi.dylib + if-no-files-found: error + + + package: + name: Package + runs-on: macos-13 + needs: + - build + - version + env: + _PKG_VERSION: ${{ needs.version.outputs.package_version }} + steps: + - name: Checkout repo + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + + - name: Install rust + uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + with: + toolchain: 1.70.0 + + - name: Cache cargo registry + uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0 + with: + key: cargo-combine-cache + + - name: Download artifacts + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + path: ./languages/swift/target + + - name: Create universal libraries + working-directory: ./languages/swift + run: | + mkdir -p ${{ github.workspace }}/universal-ios-sim/release + lipo -create -output ${{ github.workspace }}/universal-ios-sim/release/libbitwarden_uniffi.a \ + ./target/libbitwarden_uniffi.a-aarch64-apple-ios-sim/libbitwarden_uniffi.a \ + ./target/libbitwarden_uniffi.a-x86_64-apple-ios/libbitwarden_uniffi.a + + - name: Generate Swift bindings + working-directory: ./languages/swift + run: | + cargo run -p uniffi-bindgen generate \ + ./target/libbitwarden_uniffi.dylib-aarch64-apple-ios-sim/libbitwarden_uniffi.dylib \ + --library \ + --language swift \ + --no-format \ + --out-dir ./bindings + + - name: Fit bindings for xcframework + working-directory: ./languages/swift + run: | + mkdir ./Headers + mv ./bindings/BitwardenFFI.h ./Headers/ + mv ./bindings/BitwardenCoreFFI.h ./Headers/ + cat ./bindings/BitwardenFFI.modulemap ./bindings/BitwardenCoreFFI.modulemap > ./Headers/module.modulemap + + - name: Build xcframework + working-directory: ./languages/swift + run: | + xcodebuild -create-xcframework \ + -library ./target/libbitwarden_uniffi.a-aarch64-apple-ios/libbitwarden_uniffi.a \ + -headers ./Headers \ + -library ${{ github.workspace }}/universal-ios-sim/release/libbitwarden_uniffi.a \ + -headers ./Headers \ + -output ./BitwardenFFI.xcframework + + - name: Upload xcframework artifact + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + with: + name: BitwardenFFI-${{ env._PKG_VERSION }}.xcframework + path: ./languages/swift/BitwardenFFI.xcframework + if-no-files-found: error diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml new file mode 100644 index 000000000..aff42399c --- /dev/null +++ b/.github/workflows/release-swift.yml @@ -0,0 +1,71 @@ +--- +name: Release Swift Package +run-name: Release Swift Package ${{ 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 + +jobs: + validate: + name: Validate Branch - Set Version + runs-on: ubuntu-22.04 + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout repo + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + + - name: Branch check + if: ${{ github.event.inputs.release_type != 'Dry Run' }} + run: | + if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc-swift" ]]; then + echo "===================================" + echo "[!] Can only release from the 'rc' or 'hotfix-rc-cli' branches" + echo "===================================" + exit 1 + fi + + - name: Get version + id: version + run: | + VERSION=$(grep -o '^version = ".*"' crates/bitwarden/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") + echo "version=$VERSION" >> $GITHUB_OUTPUT + + + github-release: + name: GitHub Release + runs-on: ubuntu-22.04 + needs: validate + env: + _PKG_VERSION: ${{ needs.validate.outputs.version }} + steps: + - name: Download BitwardenEFI artifact + uses: bitwarden/gh-actions/download-artifacts@62d1bf7c3e31c458cc7236b1e69a475d235cd78f + with: + workflow: build-swift.yml + artifacts: BitwardenFFI-${{ env._PKG_VERSION }}.xcframework + path: packages + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'master' || github.ref_name }} + + - name: Create release + if: ${{ github.event.inputs.release_type != 'Dry Run' }} + uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 # v1.13.0 + with: + artifacts: "packages/BitwardenFFI-${{ env._PKG_VERSION }}.xcframework" + commit: ${{ github.sha }} + tag: BitwardenFFI-v${{ env._PKG_VERSION }} + name: BitwardenFFI v${{ env._PKG_VERSION }} + body: "" + token: ${{ secrets.GITHUB_TOKEN }} + draft: true From c9ecd14b53ad49e09b663b4fb03233b7fcead5eb Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Thu, 5 Oct 2023 14:30:04 -0600 Subject: [PATCH 02/31] prettier --- .github/workflows/build-swift.yml | 16 +++++++--------- .github/workflows/release-swift.yml | 5 ++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 5ad707522..a9cfef0f0 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -25,7 +25,6 @@ jobs: VERSION=$(grep -o '^version = ".*"' crates/bitwarden/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") echo "package_version=$VERSION" >> $GITHUB_OUTPUT - build: runs-on: macos-13 strategy: @@ -38,7 +37,7 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - + - name: Install rust uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable with: @@ -48,7 +47,7 @@ jobs: uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0 with: key: ${{ matrix.settings.target }}-cargo - + - name: Rustup target run: rustup target install ${{ matrix.settings.target }} @@ -73,11 +72,10 @@ jobs: path: ./target/${{ matrix.settings.target }}/release/libbitwarden_uniffi.dylib if-no-files-found: error - package: name: Package runs-on: macos-13 - needs: + needs: - build - version env: @@ -85,12 +83,12 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - + - name: Install rust uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable with: toolchain: 1.70.0 - + - name: Cache cargo registry uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0 with: @@ -126,7 +124,7 @@ jobs: mv ./bindings/BitwardenFFI.h ./Headers/ mv ./bindings/BitwardenCoreFFI.h ./Headers/ cat ./bindings/BitwardenFFI.modulemap ./bindings/BitwardenCoreFFI.modulemap > ./Headers/module.modulemap - + - name: Build xcframework working-directory: ./languages/swift run: | @@ -136,7 +134,7 @@ jobs: -library ${{ github.workspace }}/universal-ios-sim/release/libbitwarden_uniffi.a \ -headers ./Headers \ -output ./BitwardenFFI.xcframework - + - name: Upload xcframework artifact uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index aff42399c..35aacf43b 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -22,8 +22,8 @@ jobs: outputs: version: ${{ steps.version.outputs.version }} steps: - - name: Checkout repo - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 + - name: Checkout repo + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - name: Branch check if: ${{ github.event.inputs.release_type != 'Dry Run' }} @@ -41,7 +41,6 @@ jobs: VERSION=$(grep -o '^version = ".*"' crates/bitwarden/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") echo "version=$VERSION" >> $GITHUB_OUTPUT - github-release: name: GitHub Release runs-on: ubuntu-22.04 From 7abb657bef1f51c08343bf00cef500eeb83ce7e2 Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Mon, 9 Oct 2023 10:56:22 -0600 Subject: [PATCH 03/31] Push changed files to sdk-swift on release --- .github/workflows/release-swift.yml | 80 +++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index 35aacf43b..8757c614c 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -41,6 +41,7 @@ jobs: VERSION=$(grep -o '^version = ".*"' crates/bitwarden/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") echo "version=$VERSION" >> $GITHUB_OUTPUT + github-release: name: GitHub Release runs-on: ubuntu-22.04 @@ -68,3 +69,82 @@ jobs: body: "" token: ${{ secrets.GITHUB_TOKEN }} draft: true + + + repo-sync: + name: Push changed files to SDK Swift repo + runs-on: ubuntu-22.04 + needs: validate + env: + _KEY_VAULT: "bitwarden-ci" + _BOT_EMAIL: 106330231+bitwarden-devops-bot@users.noreply.github.com + _BOT_NAME: bitwarden-devops-bot + _PKG_VERSION: ${{ needs.validate.outputs.version }} + steps: + - name: Checkout SDK repo + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + with: + path: sdk + + - name: Checkout SDK-Swift repo + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + with: + repository: bitwarden/sdk-swift + path: sdk-swift + ref: main + + - name: Login to Azure - Prod Subscription + uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 + with: + creds: ${{ secrets.AZURE_CI_SERVICE_PRINCIPAL }} + + - name: Retrieve secrets + id: retrieve-secrets + uses: bitwarden/gh-actions/get-keyvault-secrets@62d1bf7c3e31c458cc7236b1e69a475d235cd78f + with: + keyvault: ${{ env._KEY_VAULT }} + secrets: "github-pat-bitwarden-devops-bot-repo-scope" + + - name: Setup Git + working-directory: sdk-swift + run: | + git config --local user.email "${{ env._BOT_EMAIL }}" + git config --local user.name "${{ env._BOT_NAME }}" + + - name: Update files + run: | + cp --verbose -rf sdk/languages/swift/README.md sdk-swift/README.md + cp --verbose -rf sdk/languages/swift/Package.swift sdk-swift/Package.swift + cp --verbose -rf sdk/languages/swift/Sources sdk-swift/Sources + cp --verbose -rf sdk/languages/swift/Tests sdk-swift/Tests + + - name: Push changes + working-directory: sdk-swift + run: | + git add . + git commit -m "Update Swift SDK to ${{ github.sha }}" + + if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then + echo "===================================" + echo "[!] Dry Run - Skipping push" + echo "===================================" + git ls-files -m + exit 0 + else + git push origin main + fi + + - name: Create release tag on SDK Swift repo + if: ${{ github.event.inputs.release_type != 'Dry Run' }} + working-directory: sdk-swift + run: | + # Check if tag exists, set output then exit 0 if true. + if git log v${{ env._PKG_VERSION }} >/dev/null 2>&1; then + echo "===================================" + echo "[!] Tag v${{ env._PKG_VERSION }} already exists" + echo "===================================" + exit 1 + fi + + git tag v${{ env._PKG_VERSION }} + git push origin v${{ env._PKG_VERSION }} From 10666d51c650edd9a7cc41966e56ce963609ce4b Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Mon, 9 Oct 2023 14:58:04 -0600 Subject: [PATCH 04/31] Linting --- .github/workflows/release-swift.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index 8757c614c..8b370d7cb 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -41,7 +41,6 @@ jobs: VERSION=$(grep -o '^version = ".*"' crates/bitwarden/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") echo "version=$VERSION" >> $GITHUB_OUTPUT - github-release: name: GitHub Release runs-on: ubuntu-22.04 @@ -70,7 +69,6 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} draft: true - repo-sync: name: Push changed files to SDK Swift repo runs-on: ubuntu-22.04 @@ -110,14 +108,14 @@ jobs: run: | git config --local user.email "${{ env._BOT_EMAIL }}" git config --local user.name "${{ env._BOT_NAME }}" - + - name: Update files run: | cp --verbose -rf sdk/languages/swift/README.md sdk-swift/README.md cp --verbose -rf sdk/languages/swift/Package.swift sdk-swift/Package.swift cp --verbose -rf sdk/languages/swift/Sources sdk-swift/Sources cp --verbose -rf sdk/languages/swift/Tests sdk-swift/Tests - + - name: Push changes working-directory: sdk-swift run: | @@ -147,4 +145,4 @@ jobs: fi git tag v${{ env._PKG_VERSION }} - git push origin v${{ env._PKG_VERSION }} + git push origin v${{ env._PKG_VERSION }} From adfcdf261ce6335e7ecb6ea883f227cbd5a8bdaa Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Thu, 19 Oct 2023 10:42:01 -0600 Subject: [PATCH 05/31] Use stable commit --- .github/workflows/build-swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index a9cfef0f0..623e53159 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -39,7 +39,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: 1.70.0 From 962590bac3493365df6a79c147f5ae783a713de3 Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Mon, 23 Oct 2023 11:24:43 -0600 Subject: [PATCH 06/31] Switch to bash script --- .github/workflows/build-swift.yml | 105 +++--------------------------- 1 file changed, 8 insertions(+), 97 deletions(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 623e53159..2666a4d61 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -27,13 +27,6 @@ jobs: build: runs-on: macos-13 - strategy: - fail-fast: false - matrix: - settings: - - target: aarch64-apple-ios-sim - - target: aarch64-apple-ios - - target: x86_64-apple-ios steps: - name: Checkout repo uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 @@ -46,98 +39,16 @@ jobs: - name: Cache cargo registry uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0 with: - key: ${{ matrix.settings.target }}-cargo + key: sdk-swift-cargo - name: Rustup target - run: rustup target install ${{ matrix.settings.target }} - - - name: Build native library - env: - IPHONEOS_DEPLOYMENT_TARGET: 13.0 - RUSTFLAGS: "-C link-arg=-Wl,-application_extension" - run: cargo build --package bitwarden-uniffi --target ${{ matrix.settings.target }} --release - working-directory: languages/swift - - - name: Upload libbitwarden_uniffi.a artifact - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 - with: - name: libbitwarden_uniffi.a-${{ matrix.settings.target }} - path: ./target/${{ matrix.settings.target }}/release/libbitwarden_uniffi.a - if-no-files-found: error - - - name: Upload libbitwarden_uniffi.dylib artifact - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 - with: - name: libbitwarden_uniffi.dylib-${{ matrix.settings.target }} - path: ./target/${{ matrix.settings.target }}/release/libbitwarden_uniffi.dylib - if-no-files-found: error - - package: - name: Package - runs-on: macos-13 - needs: - - build - - version - env: - _PKG_VERSION: ${{ needs.version.outputs.package_version }} - steps: - - name: Checkout repo - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - - - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable - with: - toolchain: 1.70.0 - - - name: Cache cargo registry - uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0 - with: - key: cargo-combine-cache - - - name: Download artifacts - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 - with: - path: ./languages/swift/target - - - name: Create universal libraries - working-directory: ./languages/swift run: | - mkdir -p ${{ github.workspace }}/universal-ios-sim/release - lipo -create -output ${{ github.workspace }}/universal-ios-sim/release/libbitwarden_uniffi.a \ - ./target/libbitwarden_uniffi.a-aarch64-apple-ios-sim/libbitwarden_uniffi.a \ - ./target/libbitwarden_uniffi.a-x86_64-apple-ios/libbitwarden_uniffi.a + rustup target install aarch64-apple-ios-sim + rustup target install aarch64-apple-ios + rustup target install x86_64-apple-ios - - name: Generate Swift bindings - working-directory: ./languages/swift + - name: Build + shell: bash run: | - cargo run -p uniffi-bindgen generate \ - ./target/libbitwarden_uniffi.dylib-aarch64-apple-ios-sim/libbitwarden_uniffi.dylib \ - --library \ - --language swift \ - --no-format \ - --out-dir ./bindings - - - name: Fit bindings for xcframework - working-directory: ./languages/swift - run: | - mkdir ./Headers - mv ./bindings/BitwardenFFI.h ./Headers/ - mv ./bindings/BitwardenCoreFFI.h ./Headers/ - cat ./bindings/BitwardenFFI.modulemap ./bindings/BitwardenCoreFFI.modulemap > ./Headers/module.modulemap - - - name: Build xcframework - working-directory: ./languages/swift - run: | - xcodebuild -create-xcframework \ - -library ./target/libbitwarden_uniffi.a-aarch64-apple-ios/libbitwarden_uniffi.a \ - -headers ./Headers \ - -library ${{ github.workspace }}/universal-ios-sim/release/libbitwarden_uniffi.a \ - -headers ./Headers \ - -output ./BitwardenFFI.xcframework - - - name: Upload xcframework artifact - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 - with: - name: BitwardenFFI-${{ env._PKG_VERSION }}.xcframework - path: ./languages/swift/BitwardenFFI.xcframework - if-no-files-found: error + chmod +x languages/swift/build.sh + ./languages/swift/build.sh From b23e9aada964e5ff37ca4297f145c367d2723dea Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Mon, 23 Oct 2023 11:27:04 -0600 Subject: [PATCH 07/31] Add back in trigger for testing --- .github/workflows/build-swift.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 2666a4d61..363a213a6 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -6,8 +6,10 @@ on: branches: - "rc" - "hotfix-rc-swift" - paths: - - "languages/swift/**" + - "DEVOPS-1525-swift-workflow-for-package-publishing" + # paths: + # - "languages/swift/**" + jobs: version: From 35a251aec2166c68006435813d00671616e87c5d Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Mon, 23 Oct 2023 15:25:06 -0600 Subject: [PATCH 08/31] Update path for build.sh --- .github/workflows/build-swift.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 363a213a6..bcde6a77d 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -51,6 +51,7 @@ jobs: - name: Build shell: bash + working-directory: languages/swift run: | - chmod +x languages/swift/build.sh - ./languages/swift/build.sh + chmod +x build.sh + ./build.sh From 6092c9a735c62ba3765bd6688b7f0e195242c1c5 Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Tue, 24 Oct 2023 08:29:21 -0600 Subject: [PATCH 09/31] Add artifact upload --- .github/workflows/build-swift.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index bcde6a77d..784e65365 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -29,6 +29,9 @@ jobs: build: runs-on: macos-13 + needs: version + env: + _VERSION: ${{ needs.version.outputs.package_version }} steps: - name: Checkout repo uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 @@ -55,3 +58,10 @@ jobs: run: | chmod +x build.sh ./build.sh + + - name: Upload BitwardenFFI.xcframework artifact + uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 + with: + name: BitwardenFFI-${{ env._VERSION }}.xcframework + path: languages/swift/BitwardenFFI.xcframework + if-no-files-found: error From 04d6f06f253c2f8199eacbebba8c875e03df90f1 Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Tue, 24 Oct 2023 11:41:34 -0600 Subject: [PATCH 10/31] Add branch, along with commit sha --- .github/workflows/build-swift.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 784e65365..947e79b52 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -6,6 +6,7 @@ on: branches: - "rc" - "hotfix-rc-swift" + - "master" - "DEVOPS-1525-swift-workflow-for-package-publishing" # paths: # - "languages/swift/**" @@ -62,6 +63,6 @@ jobs: - name: Upload BitwardenFFI.xcframework artifact uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: - name: BitwardenFFI-${{ env._VERSION }}.xcframework + name: BitwardenFFI-${{ env._VERSION }}-${GITHUB_SHA:0:7}.xcframework path: languages/swift/BitwardenFFI.xcframework if-no-files-found: error From 6bb708767342fa088c6e945b1e8fd689bf5ef5f8 Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Fri, 27 Oct 2023 10:15:10 -0600 Subject: [PATCH 11/31] Remove trigger filter --- .github/workflows/build-swift.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 947e79b52..7b3321fb8 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -8,8 +8,6 @@ on: - "hotfix-rc-swift" - "master" - "DEVOPS-1525-swift-workflow-for-package-publishing" - # paths: - # - "languages/swift/**" jobs: From 2b55e24d5419c489d04d9898b5f3f71f2d5c0abe Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Mon, 30 Oct 2023 12:33:36 -0600 Subject: [PATCH 12/31] Update package.swift with url and update tag --- .github/workflows/release-swift.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index 8b370d7cb..48526d1ac 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -111,6 +111,15 @@ jobs: - name: Update files run: | + # Update BitwardenFFI path + sed -i '' 's|.binaryTarget(name: "BitwardenFFI", path: "BitwardenFFI.xcframework")|.binaryTarget(\ + name: "BitwardenFFI",\ + url: "https://github.com/bitwarden/sdk/releases/download/BitwardenFFI-v${{ env._PKG_VERSION }}/BitwardenFFI-${{ env._PKG_VERSION }}.xcframework.zip",|' sdk/languages/swift/Package.swift + + # Run swiftformat + swiftformat sdk/languages/swift/Package.swift + + # Copy files to local sdk-swift repo path cp --verbose -rf sdk/languages/swift/README.md sdk-swift/README.md cp --verbose -rf sdk/languages/swift/Package.swift sdk-swift/Package.swift cp --verbose -rf sdk/languages/swift/Sources sdk-swift/Sources @@ -137,12 +146,12 @@ jobs: working-directory: sdk-swift run: | # Check if tag exists, set output then exit 0 if true. - if git log v${{ env._PKG_VERSION }} >/dev/null 2>&1; then + if git log ${{ env._PKG_VERSION }} >/dev/null 2>&1; then echo "===================================" - echo "[!] Tag v${{ env._PKG_VERSION }} already exists" + echo "[!] Tag ${{ env._PKG_VERSION }} already exists" echo "===================================" exit 1 fi - git tag v${{ env._PKG_VERSION }} - git push origin v${{ env._PKG_VERSION }} + git tag ${{ env._PKG_VERSION }} + git push origin ${{ env._PKG_VERSION }} From 09da1bd3106b63155b359be8b7db3f32516b2a07 Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Tue, 16 Apr 2024 09:34:37 -0600 Subject: [PATCH 13/31] Refactor release swift workflow - Add default environment variables - Update branch check - Point Bitwarden actions to main - Move github-release step to last - Create release on sdk-swift project --- .github/workflows/release-swift.yml | 83 +++++++++++++++++------------ 1 file changed, 50 insertions(+), 33 deletions(-) diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index 48526d1ac..503029a64 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -15,6 +15,9 @@ on: - Redeploy - Dry Run +env: + _KEY_VAULT: "bitwarden-ci" + jobs: validate: name: Validate Branch - Set Version @@ -28,9 +31,9 @@ jobs: - name: Branch check if: ${{ github.event.inputs.release_type != 'Dry Run' }} run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc-swift" ]]; then + if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix-rc-cli' branches" + echo "[!] Can only release from the 'rc' or 'refs/heads/hotfix-rc' branches" echo "===================================" exit 1 fi @@ -41,40 +44,11 @@ jobs: VERSION=$(grep -o '^version = ".*"' crates/bitwarden/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") echo "version=$VERSION" >> $GITHUB_OUTPUT - github-release: - name: GitHub Release - runs-on: ubuntu-22.04 - needs: validate - env: - _PKG_VERSION: ${{ needs.validate.outputs.version }} - steps: - - name: Download BitwardenEFI artifact - uses: bitwarden/gh-actions/download-artifacts@62d1bf7c3e31c458cc7236b1e69a475d235cd78f - with: - workflow: build-swift.yml - artifacts: BitwardenFFI-${{ env._PKG_VERSION }}.xcframework - path: packages - workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'master' || github.ref_name }} - - - name: Create release - if: ${{ github.event.inputs.release_type != 'Dry Run' }} - uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 # v1.13.0 - with: - artifacts: "packages/BitwardenFFI-${{ env._PKG_VERSION }}.xcframework" - commit: ${{ github.sha }} - tag: BitwardenFFI-v${{ env._PKG_VERSION }} - name: BitwardenFFI v${{ env._PKG_VERSION }} - body: "" - token: ${{ secrets.GITHUB_TOKEN }} - draft: true - repo-sync: name: Push changed files to SDK Swift repo runs-on: ubuntu-22.04 needs: validate env: - _KEY_VAULT: "bitwarden-ci" _BOT_EMAIL: 106330231+bitwarden-devops-bot@users.noreply.github.com _BOT_NAME: bitwarden-devops-bot _PKG_VERSION: ${{ needs.validate.outputs.version }} @@ -98,7 +72,7 @@ jobs: - name: Retrieve secrets id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@62d1bf7c3e31c458cc7236b1e69a475d235cd78f + uses: bitwarden/gh-actions/get-keyvault-secrets@main with: keyvault: ${{ env._KEY_VAULT }} secrets: "github-pat-bitwarden-devops-bot-repo-scope" @@ -114,7 +88,7 @@ jobs: # Update BitwardenFFI path sed -i '' 's|.binaryTarget(name: "BitwardenFFI", path: "BitwardenFFI.xcframework")|.binaryTarget(\ name: "BitwardenFFI",\ - url: "https://github.com/bitwarden/sdk/releases/download/BitwardenFFI-v${{ env._PKG_VERSION }}/BitwardenFFI-${{ env._PKG_VERSION }}.xcframework.zip",|' sdk/languages/swift/Package.swift + url: "https://github.com/bitwarden/sdk-swift/releases/download/BitwardenFFI-v${{ env._PKG_VERSION }}/BitwardenFFI-${{ env._PKG_VERSION }}.xcframework.zip",|' sdk/languages/swift/Package.swift # Run swiftformat swiftformat sdk/languages/swift/Package.swift @@ -155,3 +129,46 @@ jobs: git tag ${{ env._PKG_VERSION }} git push origin ${{ env._PKG_VERSION }} + + github-release: + name: GitHub Release + runs-on: ubuntu-22.04 + needs: + - validate + - repo-sync + env: + _PKG_VERSION: ${{ needs.validate.outputs.version }} + steps: + - name: Login to Azure - Prod Subscription + uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 + with: + creds: ${{ secrets.AZURE_CI_SERVICE_PRINCIPAL }} + + - name: Retrieve secrets + id: retrieve-secrets + uses: bitwarden/gh-actions/get-keyvault-secrets@main + with: + keyvault: ${{ env._KEY_VAULT }} + secrets: "github-pat-bitwarden-devops-bot-repo-scope" + + - name: Download BitwardenEFI artifact + uses: bitwarden/gh-actions/download-artifacts@main + with: + workflow: build-swift.yml + artifacts: BitwardenFFI-${{ env._PKG_VERSION }}.xcframework + workflow_conclusion: success + branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'master' || github.ref_name }} + skip_unpack: true + + - name: Create release + if: ${{ inputs.release_type != 'Dry Run' }} + uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 # v1.13.0 + with: + tag: v${{ env._PKG_VERSION }} + name: v${{ env._PKG_VERSION }} + body: "" + token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }} + draft: true + repo: sdk-swift + owner: bitwarden + artifacts: "BitwardenFFI-${{ env._PKG_VERSION }}.xcframework" From 3ea7b7c88ca68bd2652d9bd46a9983075899ef25 Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Tue, 16 Apr 2024 09:36:25 -0600 Subject: [PATCH 14/31] Switch back to hotfix-rc --- .github/workflows/build-swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 7b3321fb8..a8922bb4d 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -5,7 +5,7 @@ on: push: branches: - "rc" - - "hotfix-rc-swift" + - "hotfix-rc" - "master" - "DEVOPS-1525-swift-workflow-for-package-publishing" From 3dc5f124b612e6d14b5959d63aba62d4adaf19ba Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Tue, 16 Apr 2024 09:56:25 -0600 Subject: [PATCH 15/31] Fix SHA --- .github/workflows/build-swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index a8922bb4d..2d1cf8aea 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -61,6 +61,6 @@ jobs: - name: Upload BitwardenFFI.xcframework artifact uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: - name: BitwardenFFI-${{ env._VERSION }}-${GITHUB_SHA:0:7}.xcframework + name: BitwardenFFI-${{ env._VERSION }}-${${{ github.sha }}:0:7}.xcframework path: languages/swift/BitwardenFFI.xcframework if-no-files-found: error From 8ebc7a7f59b5fea73e27964460322a2da8d37fb1 Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Tue, 16 Apr 2024 10:19:25 -0600 Subject: [PATCH 16/31] Use step to get short sha --- .github/workflows/build-swift.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 2d1cf8aea..70d4a16a7 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -54,13 +54,17 @@ jobs: - name: Build shell: bash working-directory: languages/swift + id: build run: | chmod +x build.sh ./build.sh + # SHA Short + echo "short-sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + - name: Upload BitwardenFFI.xcframework artifact uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 with: - name: BitwardenFFI-${{ env._VERSION }}-${${{ github.sha }}:0:7}.xcframework + name: BitwardenFFI-${{ env._VERSION }}-${{ steps.build.outputs.short-sha }}.xcframework path: languages/swift/BitwardenFFI.xcframework if-no-files-found: error From 49ad024d046548953e3ab8d36304569dc9f5323c Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Wed, 17 Apr 2024 10:37:00 -0600 Subject: [PATCH 17/31] Pull version from bws - Lint --- .github/workflows/build-swift.yml | 3 +-- .github/workflows/release-swift.yml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 70d4a16a7..18bd76c0b 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -9,7 +9,6 @@ on: - "master" - "DEVOPS-1525-swift-workflow-for-package-publishing" - jobs: version: name: Get Version @@ -23,7 +22,7 @@ jobs: - name: Get Package Version id: retrieve-version run: | - VERSION=$(grep -o '^version = ".*"' crates/bitwarden/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") + VERSION=$(grep -o '^version = ".*"' crates/bws/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") echo "package_version=$VERSION" >> $GITHUB_OUTPUT build: diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index 503029a64..9a5195c04 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -92,7 +92,7 @@ jobs: # Run swiftformat swiftformat sdk/languages/swift/Package.swift - + # Copy files to local sdk-swift repo path cp --verbose -rf sdk/languages/swift/README.md sdk-swift/README.md cp --verbose -rf sdk/languages/swift/Package.swift sdk-swift/Package.swift From 3d799a520cfaf3f360903cddb86a259405d458aa Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Wed, 17 Apr 2024 11:46:26 -0600 Subject: [PATCH 18/31] Update install rust step --- .github/workflows/build-swift.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 18bd76c0b..f61592d08 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -35,9 +35,9 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable + uses: dtolnay/rust-toolchain@bb45937a053e097f8591208d8e74c90db1873d07 # stable with: - toolchain: 1.70.0 + toolchain: stable - name: Cache cargo registry uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0 From 4327e763746ad895f0c110bb7047d6aad1a777f8 Mon Sep 17 00:00:00 2001 From: MtnBurrit0 <77340197+mimartin12@users.noreply.github.com> Date: Wed, 24 Apr 2024 08:49:26 -0600 Subject: [PATCH 19/31] Apply suggestions from code review Thank you! Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> --- .github/workflows/build-swift.yml | 3 ++- .github/workflows/release-swift.yml | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index f61592d08..830c5849c 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -6,7 +6,7 @@ on: branches: - "rc" - "hotfix-rc" - - "master" + - "main" - "DEVOPS-1525-swift-workflow-for-package-publishing" jobs: @@ -26,6 +26,7 @@ jobs: echo "package_version=$VERSION" >> $GITHUB_OUTPUT build: + name: Build runs-on: macos-13 needs: version env: diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index 9a5195c04..343de741f 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -29,11 +29,11 @@ jobs: uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - 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 echo "===================================" - echo "[!] Can only release from the 'rc' or 'refs/heads/hotfix-rc' branches" + echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" echo "===================================" exit 1 fi @@ -105,7 +105,7 @@ jobs: git add . git commit -m "Update Swift SDK to ${{ github.sha }}" - if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then + if [[ "${{ inputs.release_type }}" == "Dry Run" ]]; then echo "===================================" echo "[!] Dry Run - Skipping push" echo "===================================" @@ -116,7 +116,7 @@ jobs: fi - name: Create release tag on SDK Swift repo - if: ${{ github.event.inputs.release_type != 'Dry Run' }} + if: ${{ inputs.release_type != 'Dry Run' }} working-directory: sdk-swift run: | # Check if tag exists, set output then exit 0 if true. @@ -157,7 +157,7 @@ jobs: workflow: build-swift.yml artifacts: BitwardenFFI-${{ env._PKG_VERSION }}.xcframework workflow_conclusion: success - branch: ${{ github.event.inputs.release_type == 'Dry Run' && 'master' || github.ref_name }} + branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} skip_unpack: true - name: Create release From e336370aa3e6b19b4167b200c2e0df48285b4c2d Mon Sep 17 00:00:00 2001 From: MtnBurrit0 <77340197+mimartin12@users.noreply.github.com> Date: Wed, 24 Apr 2024 13:07:05 -0600 Subject: [PATCH 20/31] Update .github/workflows/build-swift.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> --- .github/workflows/build-swift.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 830c5849c..cc88d59b1 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -7,7 +7,6 @@ on: - "rc" - "hotfix-rc" - "main" - - "DEVOPS-1525-swift-workflow-for-package-publishing" jobs: version: From a15a57aac19eb951861546a9ef0649149b3e0314 Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Tue, 30 Apr 2024 11:23:32 -0600 Subject: [PATCH 21/31] Automatically push main commits to sdk-swift - Using the requirement of hosting these artifacts with GitHub releases, push each commit in main to the sdk-swift repo. - Supports this implementation with requirements of GitHub releases as storage, along with pushing commits from main to sdk-swift https://github.com/bitwarden/sdk/pull/268#discussion_r1580580915 --- .github/workflows/build-swift.yml | 33 +++++++++++ .github/workflows/release-swift.yml | 90 ++++++++++++----------------- 2 files changed, 70 insertions(+), 53 deletions(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index cc88d59b1..8ab530113 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -67,3 +67,36 @@ jobs: name: BitwardenFFI-${{ env._VERSION }}-${{ steps.build.outputs.short-sha }}.xcframework path: languages/swift/BitwardenFFI.xcframework if-no-files-found: error + + trigger-swift-release: + name: Trigger Swift release + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-22.04 + needs: build + steps: + - name: Login to Azure - CI Subscription + uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 + with: + creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} + + - name: Retrieve github PAT secrets + id: retrieve-secret-pat + uses: bitwarden/gh-actions/get-keyvault-secrets@main + with: + keyvault: "bitwarden-ci" + secrets: "github-pat-bitwarden-devops-bot-repo-scope" + + - name: Trigger Swift release + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + github-token: ${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'bitwarden', + repo: 'sdk', + workflow_id: 'release-swift.yml', + ref: 'main', + inputs: { + 'build-run-id': '${{ github.run_id }}' + } + }) diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index 343de741f..52ee42fd3 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -1,49 +1,51 @@ --- name: Release Swift Package -run-name: Release Swift Package ${{ inputs.release_type }} on: - workflow_dispatch: + workflow_call: inputs: - release_type: - description: "Release Options" - required: true - default: "Initial Release" - type: choice - options: - - Initial Release - - Redeploy - - Dry Run + build-run-id: + description: "Workflow Run ID to use for artifact download" + type: string + required: false env: _KEY_VAULT: "bitwarden-ci" jobs: validate: - name: Validate Branch - Set Version + name: Set Version and SHA runs-on: ubuntu-22.04 outputs: version: ${{ steps.version.outputs.version }} + sha: ${{ steps.set-sha.outputs.sha }} + short_sha: ${{ steps.set-sha.outputs.short_sha }} steps: - name: Checkout repo uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - name: Branch check - if: ${{ 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: Get version id: version run: | VERSION=$(grep -o '^version = ".*"' crates/bitwarden/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") echo "version=$VERSION" >> $GITHUB_OUTPUT + - name: Download BitwardenEFI artifact + uses: bitwarden/gh-actions/download-artifacts@main + id: download-artifact + with: + workflow: build-swift.yml + workflow_conclusion: success + skip_unpack: true + run_id: ${{ inputs.build-run-id }} + + - name: Set SHA + id: set-sha + run: | + echo "sha=$(${{ steps.download-artifact.outputs.artifact-build-commit }})" >> $GITHUB_OUTPUT + echo "short_sha=$(echo ${{ steps.download-artifact.outputs.artifact-build-commit }} | cut -c1-7)" >> $GITHUB_OUTPUT + + repo-sync: name: Push changed files to SDK Swift repo runs-on: ubuntu-22.04 @@ -88,7 +90,7 @@ jobs: # Update BitwardenFFI path sed -i '' 's|.binaryTarget(name: "BitwardenFFI", path: "BitwardenFFI.xcframework")|.binaryTarget(\ name: "BitwardenFFI",\ - url: "https://github.com/bitwarden/sdk-swift/releases/download/BitwardenFFI-v${{ env._PKG_VERSION }}/BitwardenFFI-${{ env._PKG_VERSION }}.xcframework.zip",|' sdk/languages/swift/Package.swift + url: "https://github.com/bitwarden/sdk-swift/releases/download/BitwardenFFI-v${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}/BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework.zip",|' sdk/languages/swift/Package.swift # Run swiftformat swiftformat sdk/languages/swift/Package.swift @@ -103,32 +105,14 @@ jobs: working-directory: sdk-swift run: | git add . - git commit -m "Update Swift SDK to ${{ github.sha }}" - - if [[ "${{ inputs.release_type }}" == "Dry Run" ]]; then - echo "===================================" - echo "[!] Dry Run - Skipping push" - echo "===================================" - git ls-files -m - exit 0 - else - git push origin main - fi + git commit -m "Update Swift SDK to ${{ needs.validate.outputs.sha }}" + git push origin main - name: Create release tag on SDK Swift repo - if: ${{ inputs.release_type != 'Dry Run' }} working-directory: sdk-swift run: | - # Check if tag exists, set output then exit 0 if true. - if git log ${{ env._PKG_VERSION }} >/dev/null 2>&1; then - echo "===================================" - echo "[!] Tag ${{ env._PKG_VERSION }} already exists" - echo "===================================" - exit 1 - fi - - git tag ${{ env._PKG_VERSION }} - git push origin ${{ env._PKG_VERSION }} + git tag ${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }} + git push origin ${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }} github-release: name: GitHub Release @@ -153,22 +137,22 @@ jobs: - name: Download BitwardenEFI artifact uses: bitwarden/gh-actions/download-artifacts@main + id: download-artifact with: workflow: build-swift.yml - artifacts: BitwardenFFI-${{ env._PKG_VERSION }}.xcframework workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} + artifacts: "BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework" skip_unpack: true + run_id: ${{ inputs.build-run-id }} - name: Create release - if: ${{ inputs.release_type != 'Dry Run' }} uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 # v1.13.0 with: - tag: v${{ env._PKG_VERSION }} - name: v${{ env._PKG_VERSION }} - body: "" + tag: v${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }} + name: v${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }} + body: "" token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }} - draft: true + draft: false repo: sdk-swift owner: bitwarden - artifacts: "BitwardenFFI-${{ env._PKG_VERSION }}.xcframework" + artifacts: "BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework" From 1e1294d191269488dd9ffcf6676b059f8e640ecc Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Tue, 30 Apr 2024 12:00:54 -0600 Subject: [PATCH 22/31] Linting --- .github/workflows/release-swift.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index 52ee42fd3..816905135 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -38,14 +38,13 @@ jobs: workflow_conclusion: success skip_unpack: true run_id: ${{ inputs.build-run-id }} - + - name: Set SHA id: set-sha run: | echo "sha=$(${{ steps.download-artifact.outputs.artifact-build-commit }})" >> $GITHUB_OUTPUT echo "short_sha=$(echo ${{ steps.download-artifact.outputs.artifact-build-commit }} | cut -c1-7)" >> $GITHUB_OUTPUT - repo-sync: name: Push changed files to SDK Swift repo runs-on: ubuntu-22.04 From 86d4d72b5eb0c387ee92e093a913907fdb0ea11e Mon Sep 17 00:00:00 2001 From: Micaiah Martin Date: Thu, 6 Jun 2024 12:41:30 -0600 Subject: [PATCH 23/31] Remove unneeded permission set --- .github/workflows/build-swift.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 8ab530113..5b6c8549a 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -55,7 +55,6 @@ jobs: working-directory: languages/swift id: build run: | - chmod +x build.sh ./build.sh # SHA Short From b20ccc35ba04b25d9ac1028e6a2648774d3fa3a4 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Wed, 14 Aug 2024 11:34:44 +0200 Subject: [PATCH 24/31] Add prerelease publish --- .github/workflows/release-swift.yml | 78 +++++++++++++++++++++++++---- 1 file changed, 68 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index 816905135..ef454037f 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -5,9 +5,22 @@ on: workflow_call: inputs: build-run-id: - description: "Workflow Run ID to use for artifact download" + description: "Workflow Run ID to use for artifact download. If not provided the latest build from the selected branch will be used." type: string required: false + pre-release: + description: "Create a pre-release" + type: boolean + required: false + default: false + + workflow_dispatch: + inputs: + pre-release: + description: "Create a pre-release" + type: boolean + required: false + default: false env: _KEY_VAULT: "bitwarden-ci" @@ -20,6 +33,8 @@ jobs: version: ${{ steps.version.outputs.version }} sha: ${{ steps.set-sha.outputs.sha }} short_sha: ${{ steps.set-sha.outputs.short_sha }} + release_name: ${{ steps.set-release-name.outputs.release_name }} + run_id: ${{ steps.get-run-id.outputs.build-run-id }} steps: - name: Checkout repo uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 @@ -30,6 +45,26 @@ jobs: VERSION=$(grep -o '^version = ".*"' crates/bitwarden/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") echo "version=$VERSION" >> $GITHUB_OUTPUT + - name: Get run id + id: get-run-id + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OWNER: ${{ github.repository_owner }} + REPO: ${{ github.event.repository.name }} + run: | + if [[ -z ${{ inputs.build-run-id }} ]]; then + BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} + RUN_ID=$(gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/$OWNER/$REPO/actions/workflows/build-swift.yml/runs \ + | jq -r ".workflow_runs[] | select(.head_branch == \"$BRANCH\") | .id") + else + RUN_ID=${{ inputs.build-run-id }} + fi + + echo "build-run-id=$RUN_ID" >> $GITHUB_OUTPUT + - name: Download BitwardenEFI artifact uses: bitwarden/gh-actions/download-artifacts@main id: download-artifact @@ -37,7 +72,7 @@ jobs: workflow: build-swift.yml workflow_conclusion: success skip_unpack: true - run_id: ${{ inputs.build-run-id }} + run_id: ${{ steps.get-run-id.outputs.build-run-id }} - name: Set SHA id: set-sha @@ -45,6 +80,15 @@ jobs: echo "sha=$(${{ steps.download-artifact.outputs.artifact-build-commit }})" >> $GITHUB_OUTPUT echo "short_sha=$(echo ${{ steps.download-artifact.outputs.artifact-build-commit }} | cut -c1-7)" >> $GITHUB_OUTPUT + - name: Set release name + id: set-release-name + run: | + if [[ ${{ inputs.pre-release }} == true ]]; then + echo "release_name=${{ env._PKG_VERSION }}-unstable-${{ needs.validate.outputs.short_sha }}" >> $GITHUB_OUTPUT + else + echo "release_name=${{ env._PKG_VERSION }}" >> $GITHUB_OUTPUT + fi + repo-sync: name: Push changed files to SDK Swift repo runs-on: ubuntu-22.04 @@ -53,18 +97,29 @@ jobs: _BOT_EMAIL: 106330231+bitwarden-devops-bot@users.noreply.github.com _BOT_NAME: bitwarden-devops-bot _PKG_VERSION: ${{ needs.validate.outputs.version }} + _PRE_RELEASE: ${{ inputs.pre-release }} + _RELEASE_NAME: ${{ needs.validate.outputs.release_name }} steps: - name: Checkout SDK repo uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 with: path: sdk + - name: Get ref from SDK repo + id: get-ref + run: | + if [[ $_PRE_RELEASE == true ]]; then + echo "ref=unstable" >> $GITHUB_OUTPUT + else + echo "ref=main" >> $GITHUB_OUTPUT + fi + - name: Checkout SDK-Swift repo uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 with: repository: bitwarden/sdk-swift path: sdk-swift - ref: main + ref: ${{ steps.get-ref.outputs.ref }} - name: Login to Azure - Prod Subscription uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 @@ -89,7 +144,7 @@ jobs: # Update BitwardenFFI path sed -i '' 's|.binaryTarget(name: "BitwardenFFI", path: "BitwardenFFI.xcframework")|.binaryTarget(\ name: "BitwardenFFI",\ - url: "https://github.com/bitwarden/sdk-swift/releases/download/BitwardenFFI-v${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}/BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework.zip",|' sdk/languages/swift/Package.swift + url: "https://github.com/bitwarden/sdk-swift/releases/download/v${{ env._RELEASE_NAME }}/BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework.zip",|' sdk/languages/swift/Package.swift # Run swiftformat swiftformat sdk/languages/swift/Package.swift @@ -105,13 +160,13 @@ jobs: run: | git add . git commit -m "Update Swift SDK to ${{ needs.validate.outputs.sha }}" - git push origin main + git push origin ${{ steps.get-ref.outputs.ref }} - name: Create release tag on SDK Swift repo working-directory: sdk-swift run: | - git tag ${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }} - git push origin ${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }} + git tag v${{ env._RELEASE_NAME }} + git push origin v${{ env._RELEASE_NAME }} github-release: name: GitHub Release @@ -121,6 +176,8 @@ jobs: - repo-sync env: _PKG_VERSION: ${{ needs.validate.outputs.version }} + _RELEASE_NAME: ${{ needs.validate.outputs.release_name }} + _BUILD_RUN_ID: ${{ needs.validate.outputs.run_id }} steps: - name: Login to Azure - Prod Subscription uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 @@ -142,16 +199,17 @@ jobs: workflow_conclusion: success artifacts: "BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework" skip_unpack: true - run_id: ${{ inputs.build-run-id }} + run_id: ${{ env._BUILD_RUN_ID }} - name: Create release uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 # v1.13.0 with: - tag: v${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }} - name: v${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }} + tag: v${{ env._RELEASE_NAME }} + name: v${{ env._RELEASE_NAME }} body: "" token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }} draft: false repo: sdk-swift owner: bitwarden artifacts: "BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework" + prerelease: ${{ inputs.pre-release }} From c9ec0922a203a1dde7dc2e4a3a806597ac4f12bc Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Wed, 14 Aug 2024 11:34:57 +0200 Subject: [PATCH 25/31] Add 'pre-release' flag to build-swift workflow --- .github/workflows/build-swift.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 5b6c8549a..2a8700cf5 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -96,6 +96,7 @@ jobs: workflow_id: 'release-swift.yml', ref: 'main', inputs: { - 'build-run-id': '${{ github.run_id }}' + 'build-run-id': '${{ github.run_id }}', + 'pre-release': 'true' } }) From 2eb67eb280f79ee145db1653d662de18813a6262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Mon, 19 Aug 2024 12:02:39 +0200 Subject: [PATCH 26/31] Fix --- .github/workflows/build-swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index 2a8700cf5..c2c03f638 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -21,7 +21,7 @@ jobs: - name: Get Package Version id: retrieve-version run: | - VERSION=$(grep -o '^version = ".*"' crates/bws/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") + VERSION=$(grep -o '^version = ".*"' crates/bitwarden/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") echo "package_version=$VERSION" >> $GITHUB_OUTPUT build: From 42508a25ec2d56896291664ca262bc67d677b378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Mon, 19 Aug 2024 13:25:02 +0200 Subject: [PATCH 27/31] Fix version --- .github/workflows/build-swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-swift.yml b/.github/workflows/build-swift.yml index c2c03f638..92be9a456 100644 --- a/.github/workflows/build-swift.yml +++ b/.github/workflows/build-swift.yml @@ -21,7 +21,7 @@ jobs: - name: Get Package Version id: retrieve-version run: | - VERSION=$(grep -o '^version = ".*"' crates/bitwarden/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") + VERSION=$(grep -o '^version = ".*"' Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") echo "package_version=$VERSION" >> $GITHUB_OUTPUT build: From 5cb8e3bc4fbe8fafa0194b4b9f3cb27d73d575e5 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Tue, 20 Aug 2024 13:12:59 +0200 Subject: [PATCH 28/31] Calculate checksum --- .github/workflows/release-swift.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index ef454037f..e70764e30 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -35,6 +35,7 @@ jobs: short_sha: ${{ steps.set-sha.outputs.short_sha }} release_name: ${{ steps.set-release-name.outputs.release_name }} run_id: ${{ steps.get-run-id.outputs.build-run-id }} + swift_checksum: ${{ steps.calculate-swift-checksum.outputs.checksum }} steps: - name: Checkout repo uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 @@ -71,7 +72,6 @@ jobs: with: workflow: build-swift.yml workflow_conclusion: success - skip_unpack: true run_id: ${{ steps.get-run-id.outputs.build-run-id }} - name: Set SHA @@ -84,11 +84,16 @@ jobs: id: set-release-name run: | if [[ ${{ inputs.pre-release }} == true ]]; then - echo "release_name=${{ env._PKG_VERSION }}-unstable-${{ needs.validate.outputs.short_sha }}" >> $GITHUB_OUTPUT + echo "release_name=${{ steps.version.outputs.version }}-unstable-${{ steps.set-sha.outputs.short_sha }}" >> $GITHUB_OUTPUT else - echo "release_name=${{ env._PKG_VERSION }}" >> $GITHUB_OUTPUT + echo "release_name=${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT fi + - name: Calculate swift file checksum + run: | + CHECKSUM=$(swift package compute-checksum BitwardenFFI-${{ steps.version.outputs.version }}-${{ steps.set-sha.outputs.short_sha }}.xcframework) + echo "checksum=$CHECKSUM" >> $GITHUB_OUTPUT + repo-sync: name: Push changed files to SDK Swift repo runs-on: ubuntu-22.04 @@ -99,6 +104,7 @@ jobs: _PKG_VERSION: ${{ needs.validate.outputs.version }} _PRE_RELEASE: ${{ inputs.pre-release }} _RELEASE_NAME: ${{ needs.validate.outputs.release_name }} + _SWIFT_CHECKSUM: ${{ needs.validate.outputs.swift_checksum }} steps: - name: Checkout SDK repo uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 @@ -144,7 +150,8 @@ jobs: # Update BitwardenFFI path sed -i '' 's|.binaryTarget(name: "BitwardenFFI", path: "BitwardenFFI.xcframework")|.binaryTarget(\ name: "BitwardenFFI",\ - url: "https://github.com/bitwarden/sdk-swift/releases/download/v${{ env._RELEASE_NAME }}/BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework.zip",|' sdk/languages/swift/Package.swift + url: "https://github.com/bitwarden/sdk-swift/releases/download/v${{ env._RELEASE_NAME }}/BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework.zip",\ + checksum: "${{ env._SWIFT_CHECKSUM }}"|' sdk/languages/swift/Package.swift # Run swiftformat swiftformat sdk/languages/swift/Package.swift From 6466bf4bee64775ae6db93d45282be58f3b2af13 Mon Sep 17 00:00:00 2001 From: Michal Checinski Date: Tue, 20 Aug 2024 13:15:01 +0200 Subject: [PATCH 29/31] Remove skip_unpack --- .github/workflows/release-swift.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index e70764e30..e30d1adc4 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -205,7 +205,6 @@ jobs: workflow: build-swift.yml workflow_conclusion: success artifacts: "BitwardenFFI-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}.xcframework" - skip_unpack: true run_id: ${{ env._BUILD_RUN_ID }} - name: Create release From 57a844750e71ce98e6e528d67b7dc92e6eeefefe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Wed, 21 Aug 2024 16:01:27 +0200 Subject: [PATCH 30/31] Calc checksum on zipped file --- .github/workflows/release-swift.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index e30d1adc4..49a936a34 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -72,6 +72,7 @@ jobs: with: workflow: build-swift.yml workflow_conclusion: success + skip_unpack: true run_id: ${{ steps.get-run-id.outputs.build-run-id }} - name: Set SHA @@ -91,7 +92,7 @@ jobs: - name: Calculate swift file checksum run: | - CHECKSUM=$(swift package compute-checksum BitwardenFFI-${{ steps.version.outputs.version }}-${{ steps.set-sha.outputs.short_sha }}.xcframework) + CHECKSUM=$(swift package compute-checksum BitwardenFFI-${{ steps.version.outputs.version }}-${{ steps.set-sha.outputs.short_sha }}.xcframework.zip) echo "checksum=$CHECKSUM" >> $GITHUB_OUTPUT repo-sync: From e670576e243685f8a1d5530b9155a733831686c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Mon, 26 Aug 2024 15:30:32 +0200 Subject: [PATCH 31/31] Update .github/workflows/release-swift.yml Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> --- .github/workflows/release-swift.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-swift.yml b/.github/workflows/release-swift.yml index 49a936a34..954480365 100644 --- a/.github/workflows/release-swift.yml +++ b/.github/workflows/release-swift.yml @@ -91,6 +91,7 @@ jobs: fi - name: Calculate swift file checksum + id: calculate-swift-checksum run: | CHECKSUM=$(swift package compute-checksum BitwardenFFI-${{ steps.version.outputs.version }}-${{ steps.set-sha.outputs.short_sha }}.xcframework.zip) echo "checksum=$CHECKSUM" >> $GITHUB_OUTPUT