Skip to content

Commit

Permalink
Updated github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
DrAma999 committed Mar 2, 2021
1 parent 621be58 commit cb0dee4
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 6 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build_xcframework.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
#
# Create an XCFramework from the other built frameworks for all platforms
#
set -o pipefail

BUILD_DIR="$PWD/build"
CONFIGURATION=${CONFIGURATION:-"Release"}
DESTINATION=${1:-"."}

create_xcframework()
{
echo "Assembling xcframework for $1 ..."
rm -rf ${DESTINATION}/$1.xcframework # Start fresh
BASIC_OPTS="-framework ${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/$1.framework \
-framework ${BUILD_DIR}/${CONFIGURATION}-appletvsimulator/$1.framework \
-framework ${BUILD_DIR}/${CONFIGURATION}/$1.framework \
-framework ${BUILD_DIR}/Catalyst.xcarchive/Products/Library/Frameworks/$1.framework"

DEVICE_OPTS="-framework ${BUILD_DIR}/${CONFIGURATION}-iphoneos/$1.framework \
-framework ${BUILD_DIR}/${CONFIGURATION}-appletvos/$1.framework"

# Only include device frameworks for staging or release builds - or manual calls
if [[ "$GITHUB_REF" == "refs/heads/staging" ]] || [[ "$GITHUB_REF" == refs/tag/* ]] || [[ "$GITHUB_REF" == "" ]]; then
xcodebuild -create-xcframework -output ${DESTINATION}/$1.xcframework $BASIC_OPTS $DEVICE_OPTS
else
xcodebuild -create-xcframework -output ${DESTINATION}/$1.xcframework $BASIC_OPTS
fi
}

for f in LittleBlueTooth $(cat Frameworks.list); do
create_xcframework $f
done
49 changes: 43 additions & 6 deletions .github/workflows/swift2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,50 @@ on:
push:
tags: [master]

env:
XCODE_VER: 12.4

jobs:
create_release:
name: Create Release
test:
strategy:
matrix:
xcode_version: ['12.4']
runs-on: macos-latest
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
steps:
- name: Check out LittleBlueTooth
uses: actions/checkout@v2
- name: Build LittleBlueTooth
run: |
set -euo pipefail
swift package clean
swift build --sanitize="address"
- name: Run Tests
run: |
set -euo pipefail
swift test --sanitize="address"
- uses: actions/checkout@v2

- name: Create XCFramework
uses: unsignedapps/[email protected]
# Upload release assets for tags
release:
needs: test
if: startsWith(github.ref, 'refs/tags/')
runs-on: macos-latest
steps:
- name: Check out LittleBluetooth
uses: actions/checkout@v2
- name: Build XCFrameworks
run: |
set -euo pipefail
sudo xcode-select -s /Applications/Xcode_${XCODE_VER}.app
cd .github/workflows
./build_xcframework.sh
cp ../../LICENSE .
zip -9r LittleBlueTooth.xcframeworks.zip *.xcframework LICENSE
- name: Upload files to release draft
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
draft: true
files: Frameworks/LittleBlueTooth.xcframeworks.zip

0 comments on commit cb0dee4

Please sign in to comment.