@@ -25,6 +25,9 @@ concurrency:
2525 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
2626 cancel-in-progress : true
2727
28+ env :
29+ VERSION : " 0.4.0-$(date +%Y%m%d)"
30+
2831jobs :
2932 build-demo-ios :
3033 name : build-demo-ios
@@ -122,7 +125,7 @@ jobs:
122125 timeout : 90
123126 script : |
124127 BUILD_TOOL=cmake
125- VERSION="latest "
128+ VERSION="${{ env.VERSION }} "
126129 FRAMEWORKS=(
127130 "executorch"
128131 "backend_coreml"
@@ -203,6 +206,7 @@ jobs:
203206 shell : bash
204207 run : |
205208 set -eux
209+ VERSION="${{ env.VERSION }}"
206210
207211 pip install awscli==1.32.18
208212
@@ -211,11 +215,45 @@ jobs:
211215 AWS_CMD="aws s3 cp"
212216 fi
213217
218+ CHECKSUMS=()
214219 for FILENAME in "${RUNNER_TEMP}"/frameworks-ios/*.zip; do
215220 [ -e "${FILENAME}" ] || continue
216- shasum -a 256 "${FILENAME}"
221+ FRAMEWORK_NAME=$(basename "${FILENAME}" | sed "s/-${VERSION}.zip//")
222+ CHECKSUM=$(shasum -a 256 "${FILENAME}" | cut -d ' ' -f1)
217223 ${AWS_CMD} "${FILENAME}" s3://ossci-ios/executorch/ --acl public-read
224+ CHECKSUMS["${FRAMEWORK_NAME}"]="${CHECKSUM}"
218225 done
226+ echo "${CHECKSUMS[@]}" > checksums.txt
227+
228+ - name : Update SwiftPM
229+ shell : bash
230+ run : |
231+ set -eux
232+ VERSION="${{ env.VERSION }}"
233+
234+ git clone https://github.com/pytorch/executorch.git --branch swiftpm --depth 1
235+ cd executorch
236+ if git show-ref --verify --quiet refs/heads/swiftpm-${VERSION}; then
237+ git checkout "swiftpm-${VERSION}"
238+ else
239+ git checkout -b "swiftpm-${VERSION}"
240+ fi
241+
242+ cp -f Package.swift.template Package.swift
243+ sed -i '' "s/__VERSION__/${VERSION}/g" Package.swift
244+
245+ while read -r FRAMEWORK CHECKSUM; do
246+ sed -i '' "s/__SHA256_${FRAMEWORK}__/${CHECKSUM}/g" Package.swift
247+ done < ../checksums.txt
248+
249+ if [[ "${UPLOAD_ON_MAIN:-0}" == "1" ]]; then
250+ git add Package.swift
251+ git commit -m "${VERSION}"
252+ git push origin "swiftpm-${VERSION}"
253+ else
254+ echo "Draft Package.swift:"
255+ cat Package.swift
256+ fi
219257
220258 build-benchmark-app :
221259 name : build-benchmark-app
0 commit comments