-
Notifications
You must be signed in to change notification settings - Fork 14
150 lines (129 loc) · 4.44 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
name: Build runtimes & draft release
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
jobs:
build_binary:
# use old ubuntu for GLIBC compatibility
runs-on: ubuntu-20.04
env:
RUSTFLAGS: "-D warnings"
RUST_BACKTRACE: 1
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y build-essential git clang curl libssl-dev llvm libudev-dev make protobuf-compiler pkg-config git-restore-mtime
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2023-01-01
default: true
target: wasm32-unknown-unknown
components: rustfmt, clippy
# this is needed to make sure that cargo uses the cached target files,
# which will have an older date than the checked out source code.
- name: Restore files timestamps
run: |
# set all dirs and files mtime to the fixed timestamp, this one was chosen
# symbolically as polkadot genesis block date
find . -exec touch -t 202005260100 {} +
# restore mtime based on git commit log
git restore-mtime
- name: Setup caching for rust/cargo
uses: actions/cache@v2
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-rust-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --release
- name: Rename binary
run: cp target/release/substrate linux_x86_build
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: linux_x86_build
path: linux_x86_build
build_runtimes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Srtool build mainnet runtime
id: srtool_build
uses: chevdor/[email protected]
with:
chain: liberland
package: kitchensink-runtime
runtime_dir: ./bin/node/runtime
tag: "1.66.1"
- name: Mainnet Summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > liberland-srtool-digest.mainnet.json
cat liberland-srtool-digest.mainnet.json
cp "${{ steps.srtool_build.outputs.wasm_compressed }}" ./mainnet-${{github.ref_name}}.wasm
ls
- name: Upload mainnet runtime
uses: actions/upload-artifact@v3
with:
name: mainnet-${{github.ref_name}}.wasm
path: mainnet-${{github.ref_name}}.wasm
- name: Srtool build bastiat runtime
id: srtool_build_bastiat
uses: chevdor/[email protected]
env:
BUILD_OPTS: "--features testnet-runtime"
with:
chain: liberland
package: kitchensink-runtime
runtime_dir: ./bin/node/runtime
tag: "1.66.1"
- name: Bastiat Summary
run: |
echo '${{ steps.srtool_build_bastiat.outputs.json }}' | jq . > liberland-srtool-digest.bastiat.json
cat liberland-srtool-digest.bastiat.json
cp "${{ steps.srtool_build_bastiat.outputs.wasm_compressed }}" ./bastiat-${{github.ref_name}}.wasm
ls
- name: Upload Bastiat runtime
uses: actions/upload-artifact@v3
with:
name: bastiat-${{github.ref_name}}.wasm
path: bastiat-${{github.ref_name}}.wasm
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs:
- build_runtimes
- build_binary
steps:
- uses: actions/checkout@v3
- name: Download binary
uses: actions/download-artifact@v3
with:
name: linux_x86_build
- name: Download Bastiat runtime
uses: actions/download-artifact@v3
with:
name: bastiat-${{github.ref_name}}.wasm
- name: Download mainnet runtime
uses: actions/download-artifact@v3
with:
name: mainnet-${{github.ref_name}}.wasm
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
generate_release_notes: true
files: |
linux_x86_build
mainnet-${{github.ref_name}}.wasm
bastiat-${{github.ref_name}}.wasm
specs/bastiat.raw.json
specs/mainnet.raw.json