-
Notifications
You must be signed in to change notification settings - Fork 532
137 lines (121 loc) · 4.74 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
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:
- karura
- acala
# 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.21.3
CHAIN: ${{ github.event.inputs.chain }}
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@v4
with:
fetch-depth: 0
submodules: true
- name: Setup ENV
if: ${{ env.CHAIN == '' }}
uses: actions/github-script@v7
with:
script: |
const regex = /release-(karura|acala)-(\d+\.\d+\.\d+)/
const branch = context.ref
const [chain] = branch.match(regex).slice(1)
core.exportVariable("CHAIN", chain)
# 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 }}
profile: production
# 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 wss://${{ env.CHAIN }}-rpc.aca-api.network ${{ steps.srtool_build.outputs.wasm }} | tee ${{ env.CHAIN }}-diff.txt
# Generate release notes
- name: Generate note
id: generate-note
uses: AcalaNetwork/acala-release-note-action@master
with:
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@v4
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 }}