-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ada37e6
commit 32f2d3d
Showing
1 changed file
with
31 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ on: | |
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
VERSION: ${{ github.event.inputs.version || '0.0.13' }} | ||
VERSION: ${{ github.event.inputs.version || '0.0.14' }} | ||
TARGET_BRANCH: ${{ github.ref_name }} | ||
|
||
permissions: | ||
|
@@ -21,13 +21,13 @@ jobs: | |
config: | ||
- debug | ||
steps: | ||
# 1. Checkout the Repository with full history | ||
# 1. Checkout the Repository with Full History | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Fetch all history so that we can create and push tags | ||
|
||
# 2. Setup ccache (Optional: Improve build speeds) | ||
# 2. Setup ccache (Optional: Improve Build Speeds) | ||
- name: Run sccache-cache | ||
uses: mozilla-actions/[email protected] | ||
|
||
|
@@ -51,14 +51,28 @@ jobs: | |
run: | | ||
sudo xcode-select -s /Applications/Xcode_15.4.app | ||
# 6. Build and Package Rust XCFramework | ||
- name: Build and Package Rust XCFramework | ||
# 6. Clean Up Old Generated Files and Build | ||
- name: Clean Up Old Generated Files and Build Package XCFramework | ||
run: | | ||
# Remove old generated Swift files to prevent stale code | ||
rm -rf crates/ffi/YttriumCore/Sources/YttriumCore/SwiftFFI | ||
# Build iOS bindings (this includes running swift-bridge-cli) | ||
make build-ios-bindings | ||
# Create SwiftFFI directory for generated Swift files | ||
mkdir -p crates/ffi/YttriumCore/Sources/YttriumCore/SwiftFFI | ||
# Copy the newly generated Swift files into SwiftFFI directory | ||
cp -R crates/ffi/generated/* crates/ffi/YttriumCore/Sources/YttriumCore/SwiftFFI/ | ||
# Zip the Rust XCFramework (include only the .xcframework) | ||
make zip-rust-xcframework | ||
# Compute Rust checksum for the zipped XCFramework | ||
make compute-rust-checksum | ||
# Generate Package.swift with placeholders for checksum | ||
make generate-package-swift | ||
# 7. (Optional) Debug Environment Variables | ||
|
@@ -79,28 +93,33 @@ jobs: | |
- name: Compute Checksum and Update Package.swift | ||
id: compute_checksum | ||
run: | | ||
# Compute checksum | ||
# Compute checksum of the zipped Rust XCFramework | ||
CHECKSUM=$(swift package compute-checksum ./Output/RustXcframework.xcframework.zip) | ||
echo "Computed checksum: $CHECKSUM" | ||
# Update Package.swift with the new checksum | ||
# Assuming the binary target is named "RustXcframework" | ||
# This assumes that the checksum line contains: checksum: "PLACEHOLDER" | ||
sed -i '' "s/checksum: \".*\"/checksum: \"$CHECKSUM\"/" Package.swift | ||
echo "Updated Package.swift with new checksum." | ||
# 11. Commit and Push Package.swift | ||
- name: Commit and Push Package.swift | ||
# 11. Commit and Push Package.swift and Generated Swift Files | ||
- name: Commit and Push Changes | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use default token | ||
run: | | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
# Add Package.swift and all generated Swift files to staging | ||
git add Package.swift | ||
git add crates/ffi/YttriumCore/Sources/YttriumCore/SwiftFFI/* | ||
# Commit if there are changes | ||
if git diff --cached --quiet; then | ||
echo "No changes to commit." | ||
else | ||
git commit -m "chore: update Package.swift for version $VERSION" | ||
git commit -m "chore: update Package.swift and generated Swift files for version $VERSION" | ||
git push origin HEAD:$TARGET_BRANCH | ||
fi | ||
|
@@ -110,14 +129,14 @@ jobs: | |
VERSION: ${{ env.VERSION }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
# Ensure we're on the latest commit | ||
# Fetch the latest commits | ||
git fetch origin $TARGET_BRANCH | ||
# Get the latest commit hash | ||
COMMIT_HASH=$(git rev-parse HEAD) | ||
echo "Tagging commit ${COMMIT_HASH} with version ${VERSION}" | ||
# Create an annotated tag on the latest commit | ||
# Create an annotated tag | ||
git tag -a "${VERSION}" -m "Release version ${VERSION}" "${COMMIT_HASH}" | ||
# Push the tag to the repository | ||
|