Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archive Scheme and Create XCFramework workflows #40

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/archive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#
# This source file is part of the Stanford Biodesign Digital Health Group open-source organization
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#

name: Build XCArchive

on:
workflow_call:
inputs:
workspaceFile:
description: 'The path of the Xcode Workspace file (including the file extension).'
type: string
required: true
XCArchiveName:
philippzagar marked this conversation as resolved.
Show resolved Hide resolved
description: 'The name of the to be created XCArchive. It must not include the default XCArchive extension ".xcarchive" as the file naming is automatically done be the workflow.'
type: string
required: true
scheme:
description: 'The project scheme that should be used for the archiving process.'
type: string
required: true
version:
description: 'The version number of the XCFramework embedded in the XCArchives.'
type: string
required: true
philippzagar marked this conversation as resolved.
Show resolved Hide resolved
configuration:
description: 'The build configuration to use when archiving the scheme, either Debug or Release.'
type: string
required: false
default: 'Release'
runsonlabels:
description: 'JSON-based collection of labels indicating which type of github runner should be chosen.'
required: false
type: string
default: '["macos-13"]'
philippzagar marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build-xcarchive:
name: Build XCArchive
runs-on: ${{ fromJson(inputs.runsonlabels) }}
strategy:
matrix:
sdk: [iphoneos, iphonesimulator]
steps:
- uses: actions/checkout@v3
philippzagar marked this conversation as resolved.
Show resolved Hide resolved
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Check environment
run: |
xcodebuild -version
swift --version
echo Release version: ${{ inputs.version }}
echo SDK: ${{ matrix.sdk }}
- name: Archive for iOS
run: |
xcodebuild archive \
-workspace ${{ inputs.workspaceFile }} \
-scheme ${{ inputs.scheme }} \
-configuration ${{ inputs.configuration }} \
-sdk ${{ matrix.sdk }} \
-archivePath './.build/${{ inputs.XCArchiveName }}-${{ matrix.sdk }}.xcarchive' \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
ONLY_ACTIVE_ARCH=NO \
CI=TRUE \
ORK_FRAMEWORK_VERSION_NUMBER=${{ inputs.version }}
philippzagar marked this conversation as resolved.
Show resolved Hide resolved
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.XCArchiveName }}-${{ matrix.sdk }}.xcarchive
path: ./.build/${{ inputs.XCArchiveName }}-${{ matrix.sdk }}.xcarchive
98 changes: 98 additions & 0 deletions .github/workflows/xcframework.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#
# This source file is part of the Stanford Biodesign Digital Health Group open-source organization
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
#

name: Create XCFramework and Release

on:
workflow_call:
inputs:
workspaceFile:
description: 'The path of the Xcode Workspace file (including the file extension).'
type: string
required: true
XCFrameworkName:
philippzagar marked this conversation as resolved.
Show resolved Hide resolved
description: 'The name of the to be created XCFramework. It must not include the default XCFramework extension ".xcframework" as the file naming is automatically done be the workflow.'
type: string
required: true
XCArchiveName:
description: 'The name of the to be created XCArchive. It must not include the default XCArchive extension ".xcarchive" as the file naming is automatically done be the workflow.'
type: string
required: true
philippzagar marked this conversation as resolved.
Show resolved Hide resolved
scheme:
description: 'The project scheme that should be used for the archiving process.'
type: string
required: true
version:
description: 'The version number of the XCFramework embedded in the XCArchives. This version number is also used for the release tag.'
type: string
required: true
philippzagar marked this conversation as resolved.
Show resolved Hide resolved
configuration:
description: 'The build configuration to use when archiving the scheme, either Debug or Release.'
type: string
required: false
default: 'Release'
runsonlabels:
description: 'JSON-based collection of labels indicating which type of github runner should be chosen.'
required: false
type: string
default: '["macos-13"]'
philippzagar marked this conversation as resolved.
Show resolved Hide resolved


jobs:
build-xcarchive:
name: Build XCArchive
uses: ./.github/workflows/archive.yml
with:
archiveName: ${{ inputs.XCArchiveName }}
workspaceFile: ${{ inputs.workspaceFile }}
scheme: ${{ inputs.scheme }}
version: ${{ inputs.version }}
configuration: ${{ inputs.configuration }}
runs-on: ${{ fromJson(inputs.runsonlabels) }}
create-xcframework-and-release:
name: Build XCFramework
runs-on: ${{ fromJson(inputs.runsonlabels) }}
needs: build-xcarchive
steps:
- uses: actions/checkout@v3
philippzagar marked this conversation as resolved.
Show resolved Hide resolved
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Check environment
run: |
xcodebuild -version
swift --version
echo Release version: ${{ inputs.version }}
- uses: actions/download-artifact@v3
with:
path: ./.build
- name: Create XCFramework
run: |
rm -rf ${{ inputs.XCFrameworkName }}.xcframework
xcodebuild -create-xcframework \
-framework ./.build/${{ inputs.XCArchiveName }}-iphoneos.xcarchive/Products/Library/Frameworks/${{ inputs.XCArchiveName }}.framework \
-framework ./.build/${{ inputs.XCArchiveName }}-iphonesimulator.xcarchive/Products/Library/Frameworks/${{ inputs.XCArchiveName }}.framework \
-output ${{ inputs.XCFrameworkName }}.xcframework
rm -rf .build
- name: Commit and push XCFramework
uses: EndBug/add-and-commit@v9
with:
add: ${{ inputs.XCFrameworkName }}.xcframework
message: Create XCFramework for release ${{ inputs.version }}
tag: '${{ inputs.version }} --force'
tag_push: '--force'
- name: Create Artifacts
run: |
tar -zcvf ${{ inputs.XCFrameworkName }}.xcframework.tar.gz ${{ inputs.XCFrameworkName }}.xcframework
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ inputs.version }}
generate_release_notes: true
fail_on_unmatched_files: true
files: ${{ inputs.XCFrameworkName }}.xcframework.tar.gz
philippzagar marked this conversation as resolved.
Show resolved Hide resolved