6
6
type : string
7
7
required : true
8
8
9
+ xcode-version :
10
+ type : string
11
+ default : ' 14.3'
12
+
13
+ os-runner :
14
+ type : string
15
+ default : ' macos-13'
16
+
17
+ cacheable :
18
+ type : boolean
19
+ default : true
20
+
9
21
permissions :
10
22
contents : read
11
23
actions : write
12
24
13
25
jobs :
14
26
build-amplify-swift :
15
27
name : Build Amplify-Package | ${{ inputs.platform }}
16
- runs-on : macos-13
28
+ runs-on : ${{ inputs.os-runner }}
17
29
steps :
18
30
- name : Checkout repository
19
31
uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -25,10 +37,11 @@ jobs:
25
37
uses : ./.github/composite_actions/get_platform_parameters
26
38
with :
27
39
platform : ${{ inputs.platform }}
28
- xcode_version : ' 14.3 '
29
-
40
+ xcode_version : ${{ inputs.xcode-version }}
41
+
30
42
- name : Attempt to use the dependencies cache
31
43
id : dependencies-cache
44
+ if : inputs.cacheable
32
45
timeout-minutes : 4
33
46
continue-on-error : true
34
47
uses : actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
40
53
41
54
- name : Attempt to restore the build cache from main
42
55
id : build-cache
56
+ if : inputs.cacheable
43
57
timeout-minutes : 4
44
58
continue-on-error : true
45
59
uses : actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
@@ -55,28 +69,28 @@ jobs:
55
69
scheme : Amplify-Package
56
70
destination : ${{ steps.platform.outputs.destination }}
57
71
sdk : ${{ steps.platform.outputs.sdk }}
58
- xcode_path : /Applications/Xcode_14.3 .app
72
+ xcode_path : /Applications/Xcode_${{ inputs.xcode-version }} .app
59
73
cloned_source_packages_path : ~/Library/Developer/Xcode/DerivedData/Amplify
60
74
derived_data_path : ${{ github.workspace }}/Build
61
75
disable_package_resolution : ${{ steps.dependencies-cache.outputs.cache-hit }}
62
76
63
77
- name : Save the dependencies cache in main
64
- if : steps.dependencies-cache.outputs.cache-hit != 'true' && github.ref_name == 'main'
78
+ if : inputs.cacheable && steps.dependencies-cache.outputs.cache-hit != 'true' && github.ref_name == 'main'
65
79
uses : actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
66
80
with :
67
81
path : ~/Library/Developer/Xcode/DerivedData/Amplify
68
82
key : ${{ steps.dependencies-cache.outputs.cache-primary-key }}
69
-
83
+
70
84
- name : Delete the old build cache
71
- if : steps.build-cache.outputs.cache-hit && github.ref_name == 'main'
85
+ if : inputs.cacheable && steps.build-cache.outputs.cache-hit && github.ref_name == 'main'
72
86
env :
73
87
GH_TOKEN : ${{ github.token }}
74
88
continue-on-error : true
75
89
run : |
76
90
gh cache delete ${{ steps.build-cache.outputs.cache-primary-key }}
77
91
78
92
- name : Save the build cache
79
- if : github.ref_name == 'main'
93
+ if : inputs.cacheable && github.ref_name == 'main'
80
94
uses : actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
81
95
with :
82
96
path : ${{ github.workspace }}/Build
0 commit comments