Skip to content

Commit ba2e8d4

Browse files
committed
fix: update Package.swift checksum handling and add artifact existence check
1 parent 92e2d72 commit ba2e8d4

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

.github/workflows/main.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -628,26 +628,35 @@ jobs:
628628
run: cd packages/android && ./gradlew publishAggregationToCentralPortal -PSIGNING_KEY="${{ secrets.SIGNING_KEY }}" -PSIGNING_PASSWORD="${{ secrets.SIGNING_PASSWORD }}" -PSONATYPE_USERNAME="${{ secrets.MAVEN_CENTRAL_USERNAME }}" -PSONATYPE_PASSWORD="${{ secrets.MAVEN_CENTRAL_TOKEN }}" -PVERSION="${{ steps.tag.outputs.version }}" -PAAR_PATH="../../artifacts/adam-android-aar/adam.aar"
629629

630630
- name: update Package.swift checksum and version
631+
id: package-swift
631632
if: steps.tag.outputs.version != ''
632633
run: |
633634
VERSION=${{ steps.tag.outputs.version }}
634635
ZIP="adam-apple-xcframework-${VERSION}.zip"
635-
if [ -f "$ZIP" ]; then
636-
CHECKSUM=$(swift package compute-checksum "$ZIP")
637-
URL="https://github.com/sqliteai/adam/releases/download/${VERSION}/${ZIP}"
638-
sed -i "s|url: \".*apple-xcframework.*\"|url: \"${URL}\"|" Package.swift
639-
sed -i "s|checksum: \".*\"|checksum: \"${CHECKSUM}\"|" Package.swift
640-
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
641-
git config --global user.name "$GITHUB_ACTOR"
642-
git add Package.swift
643-
git commit -m "Update Package.swift checksum for ${VERSION} [auto-update]" || true
644-
git push origin main || true
636+
if [ ! -f "$ZIP" ]; then
637+
echo "::warning::xcframework artifact not found; skipping Package.swift update"
638+
exit 0
639+
fi
640+
CHECKSUM=$(swift package compute-checksum "$ZIP")
641+
URL="https://github.com/sqliteai/adam/releases/download/${VERSION}/${ZIP}"
642+
sed -i "s|url: \".*apple-xcframework.*\"|url: \"${URL}\"|" Package.swift
643+
sed -i "s|checksum: \".*\"|checksum: \"${CHECKSUM}\"|" Package.swift
644+
if git diff --quiet Package.swift; then
645+
echo "Package.swift already up to date for ${VERSION}"
646+
exit 0
645647
fi
648+
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
649+
git config --global user.name "$GITHUB_ACTOR"
650+
git add Package.swift
651+
git commit -m "Update Package.swift checksum for ${VERSION} [auto-update]"
652+
git push origin main
653+
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
646654
647655
- uses: softprops/action-gh-release@v2.2.1
648656
if: steps.tag.outputs.version != ''
649657
with:
650658
token: ${{ secrets.RELEASE_PAT }}
659+
target_commitish: ${{ steps.package-swift.outputs.sha }}
651660
body: |
652661
# Packages
653662

0 commit comments

Comments
 (0)