Skip to content

Commit

Permalink
improved build release script (#1753)
Browse files Browse the repository at this point in the history
* Added a new github flow file that has improved process to build and upload build artifacts

* Fixed the build script and tested in a fork repository
Removed the previous script

* Removed the srtool.yml as all the code there is included in the new improve-release

Co-authored-by: Roy Yang <roy@laminar.one>
  • Loading branch information
syan095 and Roy Yang authored Jan 14, 2022
1 parent 446d0fe commit 8bd22c5
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 197 deletions.
131 changes: 131 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
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

env:
SUBWASM_VERSION: 0.15.0

on:
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

jobs:
build-release:
name: Build and publish ${{ github.event.inputs.chain }}
runs-on: ubuntu-latest
steps:
# Checkout the Acala codebase
- name: Checkout Codebase
uses: actions/checkout@v2
with:
submodules: true

# Build WASM with Substrate Runtime Tool
- name: Srtool build
id: srtool_build
uses: chevdor/srtool-actions@v0.3.0
with:
chain: ${{ github.event.inputs.chain }}
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
# Diff new wasm with current
- name: Check the metadata diff
run: |
subwasm diff ${{ steps.srtool_build.outputs.wasm }} --chain-b ${{ github.event.inputs.chain }} | tee ${{ github.event.inputs.chain }}-diff.txt
# Generate release notes
- name: Generate note
id: generate-note
uses: AcalaNetwork/acala-release-note-action@master
with:
scope: ${{ github.event.inputs.scope }}
chain: ${{ github.event.inputs.chain }}
subwasm_info: ${{ github.event.inputs.chain }}-subwam-info.txt
srtool_details: ${{ github.event.inputs.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 ${{ 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: Upload wasm to pinata
uses: aquiladev/ipfs-action@v0.1.6
with:
path: ${{ steps.srtool_build.outputs.wasm_compressed }}
service: pinata
pinataKey: ${{ secrets.PINATA_KEY }}
pinataSecret: ${{ secrets.PINATA_SECRET }}

108 changes: 0 additions & 108 deletions .github/workflows/release-notes.yml

This file was deleted.

89 changes: 0 additions & 89 deletions .github/workflows/srtool.yml

This file was deleted.

0 comments on commit 8bd22c5

Please sign in to comment.