-
Notifications
You must be signed in to change notification settings - Fork 121
137 lines (116 loc) · 3.64 KB
/
pre_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
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'pre-v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Create Pre-release
jobs:
prepare-wasm:
name: Prepare wasm
runs-on: ubuntu-latest
container:
image: chainxorg/srtool:nightly-2021-03-01
volumes:
- ${{ github.workspace }}:/build
env:
PACKAGE: chainx-runtime
RUSTC_VERSION: nightly-2021-03-01
steps:
- uses: actions/checkout@v2
- name: Setup Python
shell: bash
run: |
apt update && apt install -y python3
- name: Build
shell: bash
run: |
cd /build
mv /build/rust-toolchain /build/rust-toolchain.bak
scripts/ci/dump_spec_version.py
build --json | tee srtool_output.json
scripts/ci/generate_release_note.py | tee release_note.md
mv /build/rust-toolchain.bak /build/rust-toolchain
- name: Upload release note
uses: actions/upload-artifact@v2
with:
name: release_note.md
path: release_note.md
- name: Upload chainx runtime wasm
uses: actions/upload-artifact@v2
with:
name: chainx_runtime.compact.wasm
path: runtime/chainx/target/srtool/release/wbuild/chainx-runtime/chainx_runtime.compact.wasm
release:
name: Create Pre-release
needs: ['prepare-wasm']
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Echo info
shell: bash
run: |
pwd
ls -R
- name: Create Pre-release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: release_note.md/release_note.md
draft: false
prerelease: true
publish:
name: Publish for ${{ matrix.os }}
needs: ["release"]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04, ubuntu-latest]
steps:
- uses: hecrj/setup-rust-action@master
with:
rust-version: stable
- uses: actions/checkout@v1
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2021-03-01
target: wasm32-unknown-unknown
profile: minimal
override: true
components: rustfmt, rust-src, clippy
- name: Build
run: cargo build --release
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/chainx
asset_name: chainx-${{ steps.get_version.outputs.VERSION }}-${{ matrix.os }}-x86_64-unknown-linux-gnu
tag: ${{ github.ref }}
publish-wasm:
name: Publish wasm
needs: ['release']
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: chainx_runtime.compact.wasm/chainx_runtime.compact.wasm
asset_name: chainx_runtime-${{ steps.get_version.outputs.VERSION }}.compact.wasm
tag: ${{ github.ref }}