@@ -49,17 +49,17 @@ jobs:
49
49
50
50
- name : Generate testnet chain specifications
51
51
run : |
52
- docker run --rm -u root ${{ steps.build.outputs.digest }} build-spec --chain testnet > chain-spec.json
53
- docker run --rm -u root ${{ steps.build.outputs.digest }} build-spec --chain testnet --raw > chain-spec-raw.json
52
+ docker run --rm -u root ${{ steps.build.outputs.digest }} build-spec --chain testnet > chain-spec-${{ github.ref_name }} .json
53
+ docker run --rm -u root ${{ steps.build.outputs.digest }} build-spec --chain testnet --raw > chain-spec-raw-${{ github.ref_name }} .json
54
54
if : matrix.image == 'node'
55
55
56
56
- name : Upload testnet chain specifications to artifacts
57
57
uses : actions/upload-artifact@v2
58
58
with :
59
59
name : chain-specifications
60
60
path : |
61
- chain-spec.json
62
- chain-spec-raw.json
61
+ chain-spec-${{ github.ref_name }} .json
62
+ chain-spec-raw-${{ github.ref_name }} .json
63
63
if-no-files-found : error
64
64
if : matrix.image == 'node'
65
65
68
68
env :
69
69
GITHUB_TOKEN : ${{ github.token }}
70
70
with :
71
- asset_paths : ' ["chain-spec. json", "chain-spec-raw.json"]'
71
+ asset_paths : ' ["chain-spec-${{ github.ref_name }}. json", "chain-spec-raw-${{ github.ref_name }} .json"]'
72
72
if : matrix.image == 'node'
73
73
74
74
executables :
@@ -77,13 +77,15 @@ jobs:
77
77
78
78
strategy :
79
79
matrix :
80
- os :
81
- - ubuntu-20.04
82
- - macos-11
83
- - windows-2019
84
- - windows-2022
80
+ build :
81
+ - os : ubuntu-20.04
82
+ suffix : ubuntu-x86_64-${{ github.ref_name }}
83
+ - os : macos-11
84
+ suffix : macos-x86_64-${{ github.ref_name }}
85
+ - os : windows-2022
86
+ suffix : windows-x86_64-${{ github.ref_name }}
85
87
86
- runs-on : ${{ matrix.os }}
88
+ runs-on : ${{ matrix.build. os }}
87
89
88
90
steps :
89
91
- name : Checkout
@@ -94,14 +96,24 @@ jobs:
94
96
uses : ilammy/msvc-dev-cmd@v1
95
97
with :
96
98
toolset : 14.29
97
- if : matrix.os == 'windows-2022'
99
+ if : matrix.build. os == 'windows-2022'
98
100
99
101
- name : Download testnet chain specifications from artifacts
100
102
uses : actions/download-artifact@v2
101
103
with :
102
104
name : chain-specifications
103
105
path : .
104
106
107
+ - name : Rename chain spec file (Linux or macOS)
108
+ run : |
109
+ mv chain-spec-${{ github.ref_name }}.json chain-spec.json
110
+ if : runner.os == 'Linux' || runner.os == 'macOS'
111
+
112
+ - name : Rename chain spec file (Windows)
113
+ run : |
114
+ move chain-spec-${{ github.ref_name }}.json chain-spec.json
115
+ if : runner.os == 'Windows'
116
+
105
117
- name : Rust toolchain
106
118
uses : actions-rs/toolchain@v1
107
119
# TODO: Below can be removed when https://github.com/actions-rs/toolchain/issues/126 is resolved
@@ -123,28 +135,76 @@ jobs:
123
135
uses : actions-rs/cargo@v1
124
136
with :
125
137
command : build
126
- args : --profile production --bins --features=subspace-node/json-chain-spec,subspace-farmer/cuda
138
+ args : --profile production --bin subspace-node --bin subspace-farmer --features=subspace-node/json-chain-spec,subspace-farmer/cuda
127
139
if : runner.os == 'Linux' || runner.os == 'Windows'
128
140
129
141
- name : Build (macOS without CUDA)
130
142
uses : actions-rs/cargo@v1
131
143
with :
132
144
command : build
133
- args : --profile production --bins --features=subspace-node/json-chain-spec
145
+ args : --profile production --bin subspace-node --bin subspace-farmer --features=subspace-node/json-chain-spec
134
146
if : runner.os == 'macOS'
135
147
136
- - name : Prepare executables for uploading (Linux or macOS)
148
+ - name : Sign Application (macOS)
149
+ run : |
150
+ echo "Importing certificate"
151
+ echo "${{ secrets.MACOS_CERTIFICATE }}" | base64 --decode > certificate.p12
152
+ security create-keychain -p "${{ secrets.MACOS_CERTIFICATE_PW }}" build.keychain
153
+ security default-keychain -s build.keychain
154
+ security unlock-keychain -p "${{ secrets.MACOS_CERTIFICATE_PW }}" build.keychain
155
+ security import certificate.p12 -k build.keychain -P "${{ secrets.MACOS_CERTIFICATE_PW }}" -T /usr/bin/codesign
156
+ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "${{ secrets.MACOS_CERTIFICATE_PW }}" build.keychain
157
+ echo "Signing farmer"
158
+ codesign --force --options=runtime -s "${{ secrets.MACOS_IDENTITY }}" --timestamp target/production/subspace-farmer
159
+ echo "Signing node"
160
+ codesign --force --options=runtime -s "${{ secrets.MACOS_IDENTITY }}" --timestamp target/production/subspace-node
161
+ echo "Creating an archive"
162
+ mkdir target/production/macos-binaries
163
+ cp target/production/subspace-farmer target/production/subspace-node target/production/macos-binaries
164
+ ditto -c -k --rsrc target/production/macos-binaries subspace-binaries.zip
165
+ echo "Notarizing"
166
+ xcrun altool --notarize-app --primary-bundle-id binaries-${{ github.ref_name }} --username "${{ secrets.MACOS_APPLE_ID}}" --password "${{ secrets.MACOS_APP_PW }}" --file subspace-binaries.zip
167
+ # TODO: Wait for notarization before stapling
168
+ # echo "Stapling farmer"
169
+ # xcrun stapler staple target/production/subspace-farmer
170
+ # echo "Stapling node"
171
+ # xcrun stapler staple target/production/subspace-node
172
+ echo "Done!"
173
+ if : runner.os == 'macOS'
174
+
175
+ - name : Sign Application (Windows)
176
+
177
+ with :
178
+ certificate : ' ${{ secrets.WINDOWS_CERTIFICATE }}'
179
+ password : ' ${{ secrets.WINDOWS_CERTIFICATE_PW }}'
180
+ certificatesha1 : ' 00A427587B911908F59B6C42BA2863109C599C1C'
181
+ folder : ' target/production'
182
+ if : runner.os == 'Windows'
183
+
184
+ - name : Prepare executables for uploading Linux
137
185
run : |
138
186
mkdir executables
139
- mv target/production/subspace-node executables/subspace-node-x86_64-${{ matrix.os }}-${{ github.ref_name }}
140
- mv target/production/subspace-farmer executables/subspace-farmer-x86_64-${{ matrix.os }}-${{ github.ref_name }}
141
- if : runner.os == 'Linux' || runner.os == 'macOS'
187
+ mv target/production/subspace-farmer executables/subspace-farmer-${{ matrix.build.suffix }}
188
+ mv target/production/subspace-node executables/subspace-node-${{ matrix.build.suffix }}
189
+ if : runner.os == 'Linux'
190
+
191
+ - name : Prepare executables for uploading macOS
192
+ run : |
193
+ mkdir executables
194
+ mv target/production/subspace-farmer executables/subspace-farmer-${{ matrix.build.suffix }}
195
+ mv target/production/subspace-node executables/subspace-node-${{ matrix.build.suffix }}
196
+ # Zip it so that signature is not lost
197
+ ditto -c -k --rsrc executables/subspace-farmer-${{ matrix.build.suffix }} executables/subspace-farmer-${{ matrix.build.suffix }}.zip
198
+ ditto -c -k --rsrc executables/subspace-node-${{ matrix.build.suffix }} executables/subspace-node-${{ matrix.build.suffix }}.zip
199
+ rm executables/subspace-farmer-${{ matrix.build.suffix }}
200
+ rm executables/subspace-node-${{ matrix.build.suffix }}
201
+ if : runner.os == 'macOS'
142
202
143
203
- name : Prepare executables for uploading (Windows)
144
204
run : |
145
205
mkdir executables
146
- move target/production/subspace-node .exe executables/subspace-node-x86_64- ${{ matrix.os }}-${{ github.ref_name }}.exe
147
- move target/production/subspace-farmer .exe executables/subspace-farmer-x86_64- ${{ matrix.os }}-${{ github.ref_name }}.exe
206
+ move target/production/subspace-farmer .exe executables/subspace-farmer- ${{ matrix.build.suffix }}.exe
207
+ move target/production/subspace-node .exe executables/subspace-node- ${{ matrix.build.suffix }}.exe
148
208
if : runner.os == 'Windows'
149
209
150
210
- name : Upload node and farmer executables to assets
0 commit comments