Skip to content

Commit

Permalink
testing github action 8
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishekinstnt committed Sep 17, 2024
1 parent 3f08aaa commit eef4e30
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 22 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/run-ios-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

# - name: Install Dependencies
# run: |
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# brew update
# brew install pkg-config libsodium openssl zeromq just jq
- name: Install Dependencies
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew install pkg-config libsodium openssl zeromq just jq
# - name: Set up Rust
# run: |
# rustc --version
# rustup default 1.78.0
# rustc --version
- name: Set up Rust
run: |
rustc --version
rustup default 1.78.0
rustc --version
- name: Run the script
env:
Expand Down
73 changes: 61 additions & 12 deletions aries/wrappers/uniffi-aries-vcx/scripts/ios.build.cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

}

release_xcframework() {
release_xcframework_backup() {

export UNIFFI_ROOT="${ARIES_VCX_ROOT}/aries/wrappers/uniffi-aries-vcx"
export IOS_APP_DIR="${ARIES_VCX_ROOT}/aries/agents/ios/ariesvcx/ariesvcx"
Expand Down Expand Up @@ -152,12 +152,22 @@

}

testing_method() {
#ASSET_URL="https://api.github.com/repos/$REPO/releases/tags/$TAG/assets"
#ASSETS_JSON=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$ASSET_URL")
delete_existing_xcframework() {

export UNIFFI_ROOT="${ARIES_VCX_ROOT}/aries/wrappers/uniffi-aries-vcx"
export IOS_APP_DIR="${ARIES_VCX_ROOT}/aries/agents/ios/ariesvcx/ariesvcx"
export ABI_PATH=${IOS_APP_DIR}/Frameworks

XCFRAMEWORK_PATH="${ABI_PATH}/vcx.xcframework.zip"

# Print for debugging
echo "XCFRAMEWORK_PATH=${XCFRAMEWORK_PATH}"

# Ensure the file has the correct permissions (readable)
chmod u+rw "$XCFRAMEWORK_PATH"

# Variables
ASSET_NAME="vcx.xcframework.zip"
# Get the name of the file to be uploaded
ASSET_NAME=$(basename "$XCFRAMEWORK_PATH")

# Fetch the release ID by tag
RELEASE_ID=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/$REPO/releases/tags/$TAG" | jq -r '.id')
Expand Down Expand Up @@ -197,13 +207,52 @@
curl -s -X DELETE -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/$REPO/releases/assets/$ASSET_ID"
done

echo "Asset deletion complete."
echo "Asset delete process complete."

}

#generate_bindings
#build_uniffi_for_demo
#build_ios_xcframework
#release_xcframework
upload_framework() {

export UNIFFI_ROOT="${ARIES_VCX_ROOT}/aries/wrappers/uniffi-aries-vcx"
export IOS_APP_DIR="${ARIES_VCX_ROOT}/aries/agents/ios/ariesvcx/ariesvcx"
export ABI_PATH=${IOS_APP_DIR}/Frameworks

# Create a release

RESPONSE=$(curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"Release $TAG\",\"draft\":false,\"prerelease\":false}" \
https://api.github.com/repos/$REPO/releases)

Extract the release ID
RELEASE_ID=$(echo $RESPONSE | jq -r .id)
echo "Release ID: $RELEASE_ID"
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV

# Define the path to your zip file
XCFRAMEWORK_PATH="${ABI_PATH}/vcx.xcframework.zip"

# Print for debugging
echo "XCFRAMEWORK_PATH=${XCFRAMEWORK_PATH}"

# Ensure the file has the correct permissions (readable)
chmod u+rw "$XCFRAMEWORK_PATH"

# Get the name of the file to be uploaded
ASSET_NAME=$(basename "$XCFRAMEWORK_PATH")

# Upload the file to the release
curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/zip" \
--data-binary @"$XCFRAMEWORK_PATH" \
"https://uploads.github.com/repos/$REPO/releases/$RELEASE_ID/assets?name=$(basename "$XCFRAMEWORK_PATH")"

}

testing_method
generate_bindings
build_uniffi_for_demo
build_ios_xcframework
delete_existing_xcframework
upload_framework

0 comments on commit eef4e30

Please sign in to comment.