-
Notifications
You must be signed in to change notification settings - Fork 119
269 lines (269 loc) · 9.62 KB
/
publish_draft_releases.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
265
266
267
268
269
name: publish draft releases
on:
push:
branches: [manta, release-**]
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+*'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DEBIAN_FRONTEND: noninteractive
jobs:
get-rust-versions:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-20.04
container:
image: paritytech/ci-linux:production
outputs:
rustc-stable: ${{ steps.get-rust-versions.outputs.stable }}
rustc-nightly: ${{ steps.get-rust-versions.outputs.nightly }}
env:
CARGO_TERM_COLOR: always
steps:
- id: get-rust-versions
run: |
echo "::set-output name=stable::$(rustc +stable --version)"
echo "::set-output name=nightly::$(rustc +nightly --version)"
build-runtimes:
timeout-minutes: 180
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-20.04
env:
CARGO_TERM_COLOR: always
strategy:
matrix:
runtime:
- name: calamari
- name: manta
steps:
- uses: actions/checkout@v2
- name: cache target dir
uses: actions/cache@v2
with:
path: "$GITHUB_WORKSPACE/runtime/${{ matrix.runtime.name }}/target"
key: srtool-target-${{ matrix.runtime.name }}-${{ github.sha }}
restore-keys: |
srtool-target-${{ matrix.runtime.name }}
- name: build runtime
id: srtool-build
uses: chevdor/[email protected]
env:
BUILD_OPTS: "--features on-chain-release-build"
with:
image: paritytech/srtool
tag: 1.74.0
chain: ${{ matrix.runtime.name }}
profile: "production"
- name: persist srtool digest
run: >
echo '${{ steps.srtool-build.outputs.json }}' |
jq > ${{ matrix.runtime.name }}-srtool-output.json
- if: always()
name: upload srtool json
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.runtime.name }}-srtool-json
path: ${{ matrix.runtime.name }}-srtool-output.json
- if: always()
name: upload runtime
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.runtime.name }}-runtime
path: |
${{ steps.srtool-build.outputs.wasm }}
${{ steps.srtool-build.outputs.wasm_compressed }}
build-node-current:
timeout-minutes: 180
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-20.04
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v2
- name: install sccache
env:
SCCACHE_RELEASE_URL: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.5.3
run: |
sudo apt update
sudo apt install -y curl
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$SCCACHE_RELEASE_URL/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: cache sccache
uses: actions/cache@v2
continue-on-error: false
with:
path: ~/.cache/sccache
key: sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
sccache-
- name: start sccache server
run: sccache --start-server
- name: init
shell: bash
run: |
sudo apt update
sudo apt install -y pkg-config libssl-dev protobuf-compiler curl build-essential clang git
protoc --version
curl -s https://sh.rustup.rs -sSf | sh -s -- -y
source ${HOME}/.cargo/env
rustup toolchain install stable
rustup default stable
rustup update
rustup target add wasm32-unknown-unknown
rustup install 1.74.0
rustup target add wasm32-unknown-unknown --toolchain 1.74.0
- name: cache cargo
uses: Swatinem/rust-cache@v2
- name: build
shell: bash
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: ~/.cache/sccache
run: |
source ${HOME}/.cargo/env
RUSTC_BOOTSTRAP=1 cargo +1.74.0 build --profile production --verbose
- name: stop sccache server
run: sccache --stop-server || true
- if: always()
name: upload
uses: actions/upload-artifact@v4
with:
name: manta
path: target/production/manta
- if: always()
name: upload
uses: actions/upload-artifact@v4
with:
name: config-for-integration-test
path: .github/resources/config-for-integration-test.json
- if: always()
name: upload
uses: actions/upload-artifact@v4
with:
name: config-for-runtime-upgrade-test
path: .github/resources/config-for-runtime-upgrade-test.json
# THE FOLLOWING HAPPENS ONLY WHEN TAGGED WITH A vX.Y.Z TAG
create-draft-release:
runs-on: ubuntu-20.04
needs: [build-runtimes]
outputs:
release_url: ${{ steps.create-release.outputs.html_url }}
asset_upload_url: ${{ steps.create-release.outputs.upload_url }}
if: startsWith(github.ref, 'refs/tags')
steps:
- name: create draft release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
publish-runtimes:
runs-on: ubuntu-20.04
needs: create-draft-release
strategy:
matrix:
runtime:
- name: calamari
- name: manta
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.runtime.name }}-runtime
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.runtime.name }}-srtool-json
- name: ruby setup
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
- name: get runtime version
id: get-runtime-version
run: |
runtime_ver="$(ruby -e '
require "./scripts/github/lib.rb";
puts get_runtime("calamari")
')"
echo "::set-output name=runtime_ver::$runtime_ver"
- name: upload compact wasm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.asset_upload_url }}
asset_path: ${{ matrix.runtime.name }}_runtime.compact.wasm
asset_name: ${{ matrix.runtime.name }}-runtime-v${{ steps.get-runtime-version.outputs.runtime_ver }}.compact.wasm
asset_content_type: application/wasm
- name: upload compressed wasm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.asset_upload_url }}
asset_path: ${{ matrix.runtime.name }}_runtime.compact.compressed.wasm
asset_name: ${{ matrix.runtime.name }}-runtime-v${{ steps.get-runtime-version.outputs.runtime_ver }}.compact.compressed.wasm
asset_content_type: application/wasm
- name: upload types json
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.asset_upload_url }}
asset_path: types.json
asset_name: ${{ matrix.runtime.name }}-types-v${{ steps.get-runtime-version.outputs.runtime_ver }}.json
asset_content_type: application/json
- name: upload srtool output json
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.asset_upload_url }}
asset_path: ${{ matrix.runtime.name }}-srtool-output.json
asset_name: ${{ matrix.runtime.name }}-srtool-output-v${{ steps.get-runtime-version.outputs.runtime_ver }}.json
asset_content_type: application/json
publish-node:
runs-on: ubuntu-20.04
needs: [build-node-current, create-draft-release]
outputs:
download_url: ${{ steps.upload-manta.outputs.browser_download_url }}
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v4
with:
name: manta
- id: upload-manta
name: upload manta
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.asset_upload_url }}
asset_path: manta
asset_name: manta
asset_content_type: application/octet-stream
brag:
runs-on: ubuntu-20.04
needs: [publish-runtimes, publish-node]
if: startsWith(github.ref, 'refs/tags')
steps:
- env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: raybot
DISCORD_AVATAR: https://gist.githubusercontent.com/grenade/66a46007b37778d81ee064394263b16c/raw/raybot.png
uses: Ilshidur/[email protected]
with:
args: 'draft runtime release ${{ github.ref }} created at ${{ needs.create-draft-release.outputs.release_url }}'