Skip to content

Commit

Permalink
[BRE-296] Fix release-swift workflow (#1035)
Browse files Browse the repository at this point in the history
## 🎟️ Tracking

<!-- Paste the link to the Jira or GitHub issue or otherwise describe /
point to where this change is coming from. -->

https://bitwarden.atlassian.net/browse/BRE-296

## 📔 Objective

<!-- Describe what the purpose of this PR is, for example what bug
you're fixing or new feature you're adding. -->

Fix `release-swift.yml` workflow

## ⏰ Reminders before review

- Contributor guidelines followed
- All formatters and local linters executed and passed
- Written new unit and / or integration tests where applicable
- Protected functional changes with optionality (feature flags)
- Used internationalization (i18n) for all UI strings
- CI builds passed
- Communicated to DevOps any deployment requirements
- Updated any necessary documentation (Confluence, contributing docs) or
informed the documentation
  team

## 🦮 Reviewer guidelines

<!-- Suggested interactions but feel free to use (or not) as you desire!
-->

- 👍 (`:+1:`) or similar for great changes
- 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info
- ❓ (`:question:`) for questions
- 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry
that's not quite a confirmed
  issue and could potentially benefit from discussion
- 🎨 (`:art:`) for suggestions / improvements
- ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or
concerns needing attention
- 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or
indications of technical debt
- ⛏ (`:pick:`) for minor or nitpick changes
  • Loading branch information
michalchecinski authored Sep 10, 2024
1 parent c0859c4 commit c04b9a0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build-swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ jobs:
path: languages/swift/BitwardenFFI.xcframework
if-no-files-found: error

- name: Upload BitwardenSdk sources
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: BitwardenSdk-${{ env._VERSION }}-${{ steps.build.outputs.short-sha }}-sources
path: languages/swift/Sources/BitwardenSdk
if-no-files-found: error

trigger-swift-release:
name: Trigger Swift release
if: github.ref == 'refs/heads/main'
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/release-swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
-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")
| jq -r "[.workflow_runs[] | select(.head_branch == \"$BRANCH\").id ] | first")
else
RUN_ID=${{ inputs.build-run-id }}
fi
Expand Down Expand Up @@ -111,6 +111,7 @@ jobs:
_PRE_RELEASE: ${{ inputs.pre-release }}
_RELEASE_NAME: ${{ needs.validate.outputs.release_name }}
_SWIFT_CHECKSUM: ${{ needs.validate.outputs.swift_checksum }}
_BUILD_RUN_ID: ${{ needs.validate.outputs.run_id }}
steps:
- name: Checkout SDK repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand Down Expand Up @@ -163,6 +164,16 @@ jobs:
git config --local user.email "${{ env._BOT_EMAIL }}"
git config --local user.name "${{ env._BOT_NAME }}"
- name: Download BitwardenSdk sources artifact
uses: bitwarden/gh-actions/download-artifacts@main
id: download-artifact
with:
workflow: build-swift.yml
workflow_conclusion: success
artifacts: "BitwardenSdk-${{ env._PKG_VERSION }}-${{ needs.validate.outputs.short_sha }}-sources"
run_id: ${{ env._BUILD_RUN_ID }}
path: sdk/languages/swift/Sources/BitwardenSdk

- name: Install Swift formatter
run: |
git clone https://github.com/nicklockwood/SwiftFormat
Expand All @@ -181,11 +192,16 @@ jobs:
# Run swiftformat
swiftformat sdk/languages/swift/Package.swift
find sdk/languages/swift/Sources/ -name ".gitignore" -exec rm -f {} \;
rm -rf sdk-swift/Sources
rm -rf sdk-swift/Tests
# 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
cp --verbose -rf sdk/languages/swift/Tests sdk-swift/Tests
cp --verbose -rf sdk/languages/swift/Sources sdk-swift
cp --verbose -rf sdk/languages/swift/Tests sdk-swift
- name: Push changes
working-directory: sdk-swift
Expand Down

0 comments on commit c04b9a0

Please sign in to comment.