-
Notifications
You must be signed in to change notification settings - Fork 5
126 lines (109 loc) · 4.5 KB
/
prepare-xcframework-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Build xcframework and prepare release
on:
workflow_dispatch:
inputs:
product_name:
description: 'The Xcode product name'
required: true
default: 'GliaWidgets'
xcode_scheme:
description: 'Xcode workspace scheme. It will be used for archieving project.'
required: true
default: 'GliaWidgets'
jobs:
build:
name: Create PR, draft release, and build xcframework
runs-on: macos-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Dependencies
run: |
bundle install
pod install --repo-update
- name: Archieve iphoneos
run: |
xcodebuild archive \
-workspace "${{ github.event.inputs.product_name }}.xcworkspace" \
-scheme "${{ github.event.inputs.xcode_scheme }}" \
-sdk iphoneos \
-archivePath "xcf/${{ github.event.inputs.product_name }}-iphoneos.xcarchive" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES | xcpretty
shell: bash
- name: Archieve iphonesimulator
run: |
xcodebuild archive \
-workspace "${{ github.event.inputs.product_name }}.xcworkspace" \
-scheme "${{ github.event.inputs.xcode_scheme }}" \
-sdk iphonesimulator \
-archivePath "xcf/${{ github.event.inputs.product_name }}-iossimulator.xcarchive" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES | xcpretty
shell: bash
- name: Create xcframework
run: |
xcodebuild -create-xcframework \
-framework "xcf/${{ github.event.inputs.product_name }}-iphoneos.xcarchive/Products/Library/Frameworks/${{ github.event.inputs.product_name }}.framework" \
-framework "xcf/${{ github.event.inputs.product_name }}-iossimulator.xcarchive/Products/Library/Frameworks/${{ github.event.inputs.product_name }}.framework" \
-output "xcf/${{ github.event.inputs.product_name }}.xcframework"
shell: bash
- name: Zip xcframework
run: |
cd xcf
zip -r GliaWidgetsXcf.xcframework.zip GliaWidgets.xcframework
shell: bash
- name: Calculate checksum
id: calculate_xcf_checksum
run: |
cd xcf
echo "checksum=$(swift package compute-checksum GliaWidgetsXcf.xcframework.zip | tail -1 | tr -d '\n')" >> "$GITHUB_OUTPUT"
shell: bash
- name: Fetch semver
id: fetch_semver
run: |
cd GliaWidgets
filename=StaticValues.swift
echo "semver=$(grep 'sdkVersion\s*=\s*"' "$filename" | awk -F'"' '{print $2}')" >> "$GITHUB_OUTPUT"
shell: bash
- name: Update Package.swift
run: |
semver=${{ steps.fetch_semver.outputs.semver}}
checksum=${{ steps.calculate_xcf_checksum.outputs.checksum}}
release_branch_name="release/xcf/${{ steps.fetch_semver.outputs.semver}}"
chmod +x ./scripts/update_ios_widgets_package.sh
./scripts/update_ios_widgets_package.sh "$semver" "$checksum" "$release_branch_name"
shell: bash
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: "release/xcf/${{ steps.fetch_semver.outputs.semver}}"
title: 'GliaWidgets SDK Release ${{ steps.fetch_semver.outputs.semver}}'
commit-message: |
GliaWidgets SDK XCFramework Release ${{ steps.fetch_semver.outputs.semver}}
base: 'master'
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.fetch_semver.outputs.semver}}
release_name: "GliaWidgetsSDK Release ${{ steps.fetch_semver.outputs.semver}}"
draft: true
prerelease: false
body: |
GliaWidgetsSDK Release
xcframework checksum: `${{ steps.calculate_xcf_checksum.outputs.checksum }}`
- uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "xcf/GliaWidgetsXcf.xcframework.zip"
asset_name: "GliaWidgetsXcf.xcframework.zip"
asset_content_type: "application/zip"