-
Notifications
You must be signed in to change notification settings - Fork 243
53 lines (46 loc) · 1.9 KB
/
runtime-snapshot-build.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
# This action enabling building WASM runtime used for forkless runtime upgrades, can be triggered manually or by
# release creation.
#
# WASM bundles are built both for releases and for manually triggered runs, uploaded to artifacts and assets.
name: Runtime snapshot build
on:
workflow_dispatch:
push:
tags:
- "runtime-snapshot-*"
- "runtime-gemini-*"
jobs:
runtime:
runs-on: ${{ fromJson(github.repository_owner == 'subspace' && '["self-hosted", "ubuntu-20.04-x86-64"]' || 'ubuntu-22.04') }}
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # @v3.1.0
- name: Build runtime
id: build
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # @v3.2.0
with:
file: Dockerfile-runtime
push: false
- name: Extract runtime
run: |
SPEC_VERSION=$(sed -nr 's/.*spec_version: ([0-9]+),/\1/p' crates/subspace-runtime/src/lib.rs)
docker run --rm -u root ${{ steps.build.outputs.digest }} > subspace_runtime-$SPEC_VERSION.compact.compressed.wasm
echo "SPEC_VERSION=$SPEC_VERSION" >> $GITHUB_ENV
- name: Upload runtime to artifacts
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # @v3.1.1
with:
name: subspace_runtime
path: |
subspace_runtime-${{ env.SPEC_VERSION }}.compact.compressed.wasm
if-no-files-found: error
- name: Upload runtime to assets
uses: alexellis/upload-assets@259de5111cb56966d046ced998941e93f91d2c93 # @0.4.0
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["subspace_runtime-${{ env.SPEC_VERSION }}.compact.compressed.wasm"]'
# Only run for releases
if: github.event_name == 'push' && github.ref_type == 'tag'