-
Notifications
You must be signed in to change notification settings - Fork 62
264 lines (249 loc) · 9.13 KB
/
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
name: Create a Release
on:
workflow_dispatch:
inputs:
major:
description: "Major"
type: boolean
default: false
minor:
description: "Minor"
type: boolean
default: false
jobs:
build-skia:
strategy:
matrix:
arch: ["x86", "x64", "arm", "arm64", "iossim_arm64"]
runs-on: macos-12
permissions:
id-token: write
contents: read
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.ACTIONS_ROLE }}
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.PAT_GITHUB }}
- name: Update Java
uses: actions/setup-java@v2
with:
distribution: "zulu"
java-version: "16"
- name: Installing pre-requisites
run: |
set -x
# Install some dependencies & premake5
brew install ninja
curl https://github.com/premake/premake-core/releases/download/v5.0.0-beta1/premake-5.0.0-beta1-macosx.tar.gz -L -o premake_macosx.tar.gz
tar -xvf premake_macosx.tar.gz 2>/dev/null
rm premake_macosx.tar.gz
sudo chmod a+x premake5
mkdir bin
cp premake5 bin/premake5
sudo mv premake5 /usr/local/bin
- name: Build skia files
run: ./scripts/build.skia.sh -a ${{ matrix.arch }}
determine_version:
name: Determine the next build version
needs: build-skia
runs-on: ubuntu-latest
outputs:
version: ${{ steps.echo_version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: npm ci
working-directory: ./.github/release
- if: ${{ inputs.major == true }}
id: determine_version_major
name: Get Version - MAJOR
run: npm run release -- major --ci --release-version | tail -n 1 > RELEASE_VERSION
working-directory: ./.github/release
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }}
- if: ${{inputs.major == false && inputs.minor == true}}
id: determine_version_minor
name: Get Version - MINOR
run: npm run release -- minor --ci --release-version | tail -n 1 > RELEASE_VERSION
working-directory: ./.github/release
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }}
- if: ${{ inputs.major == false && inputs.minor == false }}
id: determine_version_patch
name: Get Version - PATCH
run: npm run release -- --ci --release-version | tail -n 1 > RELEASE_VERSION
working-directory: ./.github/release
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }}
- id: echo_version
run: echo "::set-output name=version::$(cat ./.github/release/RELEASE_VERSION)"
build_framework:
name: Create RiveRuntime.xcframework
runs-on: macos-12
needs: [determine_version]
outputs:
checksum: ${{steps.get_checksum.outputs.checksum}}
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.PAT_GITHUB }}
- name: Get Renderer ref
id: renderer-ref
run: echo "REF_VALUE=$(cat .rive_renderer)" >> $GITHUB_OUTPUT
- name: Checkout Rive Renderer Repo
uses: actions/checkout@v3
with:
submodules: true
repository: ${{ secrets.RIVE_RENDERER_REPO }}
token: ${{ secrets.PAT_GITHUB }}
path: ./submodules/pls
ref: ${{ steps.renderer-ref.outputs.REF_VALUE }}
- name: Installing pre-requisites
run: |
set -x
# Install some dependencies & premake5
brew install ninja
curl https://github.com/premake/premake-core/releases/download/v5.0.0-beta1/premake-5.0.0-beta1-macosx.tar.gz -L -o premake_macosx.tar.gz
tar -xvf premake_macosx.tar.gz 2>/dev/null
rm premake_macosx.tar.gz
mkdir bin
sudo chmod a+x premake5
cp premake5 bin/premake5
sudo mv premake5 /usr/local/bin
pip3 install ply
- name: Build everything (using the cache, we should make an archive of course)
run: ./scripts/build.sh all
- name: Update Marketing versions
run: agvtool new-marketing-version ${{ needs.determine_version.outputs.version }}
- name: Upload versionFiles
uses: actions/upload-artifact@v3
with:
name: version-files
path: |
RiveRuntime.xcodeproj/project.pbxproj
Source/Info.plist
Tests/Info.plist
- id: build_frameworks
name: Build frameworks
run: sh ./scripts/build_framework.sh -c Release
- id: zip
name: Zip the framework
# --symlinks is critical here to retain the structure of a macos framework.
run: zip --symlinks -r RiveRuntime.xcframework.zip RiveRuntime.xcframework
working-directory: ./archive
- id: get_checksum
name: Add the checksum of the zip file into our environment
run: echo "::set-output name=checksum::$(swift package compute-checksum archive/RiveRuntime.xcframework.zip)"
- name: Upload xcFramework
uses: actions/upload-artifact@v3
with:
name: RiveRuntime.xcframework.zip
path: archive/RiveRuntime.xcframework.zip
- name: Upload versionFiles
uses: actions/upload-artifact@v3
with:
name: version-files
path: |
Source/Info.plist
Tests/Info.plist
do_release:
name: Do the actual release
runs-on: ubuntu-latest
needs: [determine_version, build_framework]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
run: npm ci
working-directory: ./.github/release
- id: read_package_template
uses: pCYSl5EDgo/cat@master
with:
path: .github/workflows/Package.swift.template
- name: Create Package.swift
run: |
cat > Package.swift <<-EOF
${{ steps.read_package_template.outputs.text }}
EOF
env:
CHECKSUM: ${{ needs.build_framework.outputs.checksum }}
RELEASE_VERSION: ${{ needs.determine_version.outputs.version }}
- id: read_podspec_template
uses: pCYSl5EDgo/cat@master
with:
path: .github/workflows/RiveRuntime.podspec.template
- name: Create RiveRuntime.podspec
run: |
cat > RiveRuntime.podspec <<-EOF
${{ steps.read_podspec_template.outputs.text }}
EOF
env:
RELEASE_VERSION: ${{ needs.determine_version.outputs.version }}
- name: Upload podspec file
uses: actions/upload-artifact@v2
with:
name: RiveRuntime.podspec
path: RiveRuntime.podspec
- name: Git config
run: |
git config --local user.email '[email protected]'
git config --local user.name ${{ github.actor }}
- name: Download versionFiles
uses: actions/download-artifact@v3
with:
name: version-files
- name: Add & commit version files (might want to look into doing this in release-it)
run: git add RiveRuntime.podspec Package.swift Source/Info.plist Tests/Info.plist && git commit -m "Updating version files"
- name: Download framework artifact
uses: actions/download-artifact@v2
with:
name: RiveRuntime.xcframework.zip
path: archive/
- if: ${{ inputs.major == true }}
name: Major Release - Bump version number, update changelog, push and tag
run: npm run release -- major --ci
working-directory: ./.github/release
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }}
- if: ${{inputs.major == false && inputs.minor == true}}
name: Minor release - Bump version number, update changelog, push and tag
run: npm run release -- minor --ci
working-directory: ./.github/release
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }}
- if: ${{inputs.major == false && inputs.minor == false}}
name: Build release - Bump version number, update changelog, push and tag
run: npm run release -- --ci
working-directory: ./.github/release
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }}
publish_cocoapods:
name: Publish framework to cocoapods
runs-on: macos-12
needs: [determine_version, build_framework, do_release]
steps:
- name: Download framework artifact
uses: actions/download-artifact@v3
with:
name: RiveRuntime.xcframework.zip
- name: Download podspec file
uses: actions/download-artifact@v3
with:
name: RiveRuntime.podspec
- name: Extract archive to pass cocoapods validation
run: unzip RiveRuntime.xcframework.zip
- name: Publish pod to the CocoaPods
uses: michaelhenry/[email protected]
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}