-
Notifications
You must be signed in to change notification settings - Fork 20
156 lines (141 loc) · 5.58 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
name: Publish Release
# This script is based on Acala's own release script and is used to build and publish the release WASM build of the runtime:
# - Checkout the selected branch
# - Build WASM using Substrate Runtime Tool
# - Use subwasm to obtain build data
# - Generate release note
# - Create release issue
# - Archive the build artifacts to Github
env:
SUBWASM_VERSION: 0.17.0
on:
workflow_dispatch:
inputs:
# Get name of the chain
chain:
description: Chain Runtime (default = tinkernet)
required: true
default: tinkernet
type: choice
options:
- tinkernet
- invarch
# Get the scope of release note
scope:
description: Release scope (default = full)
required: true
default: full
type: choice
options:
- client
- runtime
- full
tag:
description: 'Release version (e.g. v0.1.0)'
required: true
# Get the SR Tool image used to build
srtool_image:
description: Default to use the latest. You can use an alternate image, use with caution!
required: false
jobs:
release:
name: Build and publish ${{ github.event.inputs.chain }}
runs-on: ubuntu-latest
steps:
- name: Checkout Codebase
uses: actions/checkout@v3
with:
submodules: true
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Install deps
run: sudo apt -y install protobuf-compiler
- name: Install & display rust toolchain
working-directory: ./${{ github.event.inputs.chain }}
run: rustup show
# Build WASM with Substrate Runtime Tool
- name: Srtool build
id: srtool_build
uses: chevdor/[email protected]
env:
BUILD_OPTS: ""
with:
chain: ${{ github.event.inputs.chain }}
runtime_dir: ./${{ github.event.inputs.chain }}/runtime
tag: ${{ github.event.inputs.srtool_image }}
# Output the build summary
- name: Build Summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > ${{ github.event.inputs.chain }}-srtool-digest.json
cat ${{ github.event.inputs.chain }}-srtool-digest.json
echo "Runtime location: ${{ steps.srtool_build.outputs.wasm }}"
# install subwasm
- name: Install subwasm ${{ env.SUBWASM_VERSION }}
run: |
wget https://github.com/chevdor/subwasm/releases/download/v${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb
sudo dpkg -i subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb
subwasm --version
# Display information for wasm
- name: Extract metadata
run: |
subwasm --json info ${{ steps.srtool_build.outputs.wasm }} > ${{ github.event.inputs.chain }}-info.json
subwasm info ${{ steps.srtool_build.outputs.wasm }} > ${{ github.event.inputs.chain }}-info.txt
cat ${{ github.event.inputs.chain }}-info.txt
subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ github.event.inputs.chain }}-subwam-info.json
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ github.event.inputs.chain }}-subwam-info.txt
cat ${{ github.event.inputs.chain }}-subwam-info.txt
- name: Archive Artifacts for ${{ github.event.inputs.chain }}
uses: actions/upload-artifact@v2
with:
name: ${{ github.event.inputs.chain }}-runtime
path: |
${{ steps.srtool_build.outputs.wasm }}
${{ steps.srtool_build.outputs.wasm_compressed }}
${{ github.event.inputs.chain }}-srtool-digest.json
${{ github.event.inputs.chain }}-metadata.json
${{ github.event.inputs.chain }}-metadata.txt
${{ github.event.inputs.chain }}-subwam-info.json
${{ github.event.inputs.chain }}-subwam-info.txt
${{ github.event.inputs.chain }}-diff.txt
- name: Create Tag
uses: negz/create-tag@v1
with:
version: ${{ github.event.inputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Generate template data
run: |
TAG=${{ github.event.inputs.tag }}
NETWORK=${{ github.event.inputs.chain }}
SRTOOL_DETAILS=$(cat ${{ github.event.inputs.chain }}-srtool-digest.json)
SUBWASM_DETAILS=$(cat ${{ github.event.inputs.chain }}-subwam-info.json)
echo 'Template data:'
jq -n \
--arg tag "$TAG" \
--arg network "$NETWORK" \
--arg srtool_details "$SRTOOL_DETAILS" \
--arg subwasm_details "$SUBWASM_DETAILS" \
'{
tag: $tag,
network: $network,
srtool_details: $srtool_details,
subwasm_details: $subwasm_details
}' | tee template_data.json
- name: Render release page
uses: jayamanikharyono/[email protected]
with:
datafile: template_data.json
path: .github/release-template.md
- name: Publish github release
uses: softprops/action-gh-release@v1
with:
files: |
${{ steps.srtool_build.outputs.wasm }}
${{ steps.srtool_build.outputs.wasm_compressed }}
body_path: ".github/release-template.md"
tag_name: ${{ github.event.inputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}