-
Notifications
You must be signed in to change notification settings - Fork 548
148 lines (131 loc) · 4.94 KB
/
publish-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
name: Publish Release
# This script is used to build and publish the release WASM build of Acala 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
# - Publish the WASM to Pinata via ipfs
on:
create:
workflow_dispatch:
inputs:
# Get name of the chain
chain:
description: Chain Runtime (default = karura)
required: true
default: karura
type: choice
options:
- mandala
- karura
- acala
# Get the scope of release note
scope:
description: Release scope (default = full)
required: true
default: full
type: choice
options:
- client
- runtime
- full
# 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
env:
SUBWASM_VERSION: 0.20.0
CHAIN: ${{ github.event.inputs.chain }}
SCOPE: ${{ github.event.inputs.scope }}
jobs:
build-release:
name: Build and publish ${{ github.event.inputs.chain || github.ref }}
runs-on: ubuntu-latest
# Skip non-release branches
if: startsWith(github.ref_name, 'release-')
steps:
# Checkout the Acala codebase
- name: Checkout Codebase
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Setup ENV
if: ${{ env.CHAIN == '' || env.SCOPE == '' }}
run: python .github/scripts/publish_release_setup_env.py
# Build WASM with Substrate Runtime Tool
- name: Srtool build
id: srtool_build
uses: chevdor/[email protected]
env:
BUILD_OPTS: "--features on-chain-release-build,no-metadata-docs"
with:
chain: ${{ env.CHAIN }}
tag: ${{ github.event.inputs.srtool_image }}
# Output the build summary
- name: Build Summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > ${{ env.CHAIN }}-srtool-digest.json
cat ${{ env.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 }} > ${{ env.CHAIN }}-info.json
subwasm info ${{ steps.srtool_build.outputs.wasm }} > ${{ env.CHAIN }}-info.txt
cat ${{ env.CHAIN }}-info.txt
subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ env.CHAIN }}-subwam-info.json
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ env.CHAIN }}-subwam-info.txt
cat ${{ env.CHAIN }}-subwam-info.txt
# Diff new wasm with current
- name: Check the metadata diff
run: |
subwasm diff ${{ steps.srtool_build.outputs.wasm }} --chain-b ${{ env.CHAIN }} | tee ${{ env.CHAIN }}-diff.txt
# Generate release notes
- name: Generate note
id: generate-note
uses: AcalaNetwork/acala-release-note-action@master
with:
scope: ${{ env.SCOPE }}
chain: ${{ env.CHAIN }}
subwasm_info: ${{ env.CHAIN }}-subwam-info.txt
srtool_details: ${{ env.CHAIN }}-srtool-digest.json
# Create release checklist issue
- name: Crate Release Checklist issue
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: ${{ steps.generate-note.outputs.release-note }}
- name: Archive Artifacts for ${{ env.CHAIN }}
uses: actions/upload-artifact@v2
with:
name: ${{ env.CHAIN }}-runtime
path: |
${{ steps.srtool_build.outputs.wasm }}
${{ steps.srtool_build.outputs.wasm_compressed }}
${{ env.CHAIN }}-srtool-digest.json
${{ env.CHAIN }}-metadata.json
${{ env.CHAIN }}-metadata.txt
${{ env.CHAIN }}-subwam-info.json
${{ env.CHAIN }}-subwam-info.txt
${{ env.CHAIN }}-diff.txt
- name: Upload wasm to pinata
uses: aquiladev/[email protected]
with:
path: ${{ steps.srtool_build.outputs.wasm_compressed }}
service: pinata
pinataKey: ${{ secrets.PINATA_KEY }}
pinataSecret: ${{ secrets.PINATA_SECRET }}