mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-25 18:47:56 +00:00
Github workflow to automate release draft creation (#3978)
This PR introduces the github flow which will create a release draft automatically when the rc tag is pushed. The flow contains the following steps: - Gets the info about rust version used to build the node - Builds the runtimes using `srtool` - Extracts the info about each runtime - Aggregates the changelog from the prdocs - Creates the release draft containing all the info related to the release (changelog, runtimes, rust versions) - Attaches the runtimes to the draft - Posts the message to the RelEng internal channel to inform that the build is done. Related to the #3295 --------- Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -2,11 +2,16 @@
|
||||
|
||||
export PRODUCT=polkadot
|
||||
export VERSION=${VERSION:-1.5.0}
|
||||
export ENGINE=${ENGINE:-docker}
|
||||
export REF1=${REF1:-'HEAD'}
|
||||
export REF2=${REF2}
|
||||
export RUSTC_STABLE=${RUSTC_STABLE:-'1.0'}
|
||||
export RUSTC_NIGHTLY=${RUSTC_NIGHTLY:-'1.0'}
|
||||
|
||||
PROJECT_ROOT=`git rev-parse --show-toplevel`
|
||||
echo $PROJECT_ROOT
|
||||
|
||||
TMP=$(mktemp -d)
|
||||
TMP=${TMP:-$(mktemp -d)}
|
||||
TEMPLATE_AUDIENCE="${PROJECT_ROOT}/scripts/release/templates/audience.md.tera"
|
||||
TEMPLATE_CHANGELOG="${PROJECT_ROOT}/scripts/release/templates/changelog.md.tera"
|
||||
|
||||
@@ -21,7 +26,7 @@ OUTPUT="${TMP}/changelogs/$PRODUCT/$VERSION"
|
||||
echo -e "OUTPUT: \t\t$OUTPUT"
|
||||
mkdir -p $OUTPUT
|
||||
|
||||
prdoc load -d "$PROJECT_ROOT/prdoc/$VERSION" --json > $DATA_JSON
|
||||
$ENGINE run --rm -v ${PROJECT_ROOT}:/repo paritytech/prdoc load -d "prdoc/$VERSION" --json > $DATA_JSON
|
||||
# ls -al $DATA_JSON
|
||||
|
||||
cat $DATA_JSON | jq ' { "prdoc" : .}' > $CONTEXT_JSON
|
||||
@@ -48,8 +53,58 @@ for audience in "${audiences[@]}"; do
|
||||
echo "Processing audience: $audience ($audience_id)"
|
||||
export TARGET_AUDIENCE=$audience
|
||||
tera -t "${TEMPLATE_AUDIENCE}" --env --env-key env "${CONTEXT_JSON}" > "$OUTPUT/relnote_${audience_id}.md"
|
||||
cat "$OUTPUT/relnote_${audience_id}.md" >> "$OUTPUT/relnote_combined.md"
|
||||
cat "$OUTPUT/relnote_${audience_id}.md" >> "$PROJECT_ROOT/scripts/release/templates/changelog.md"
|
||||
done
|
||||
|
||||
# Show the files
|
||||
tree -s -h -c $OUTPUT/
|
||||
|
||||
ASSET_HUB_ROCOCO_DIGEST=${ASSET_HUB_ROCOCO_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/asset-hub-rococo-srtool-digest.json"}
|
||||
ASSET_HUB_WESTEND_DIGEST=${ASSET_HUB_WESTEND_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/asset-hub-westend-srtool-digest.json"}
|
||||
BRIDGE_HUB_ROCOCO_DIGEST=${BRIDGE_HUB_ROCOCO_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/bridge-hub-rococo-srtool-digest.json"}
|
||||
BRIDGE_HUB_WESTEND_DIGEST=${BRIDGE_HUB_WESTEND_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/bridge-hub-westend-srtool-digest.json"}
|
||||
COLLECTIVES_WESTEND_DIGEST=${COLLECTIVES_WESTEND_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/collectives-westend-srtool-digest.json"}
|
||||
CONTRACTS_ROCOCO_DIGEST=${CONTRACTS_ROCOCO_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/contracts-rococo-srtool-digest.json"}
|
||||
CORETIME_ROCOCO_DIGEST=${CORETIME_ROCOCO_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/coretime-rococo-srtool-digest.json"}
|
||||
CORETIME_WESTEND_DIGEST=${CORETIME_WESTEND_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/coretime-westend-srtool-digest.json"}
|
||||
GLUTTON_WESTEND_DIGEST=${GLUTTON_WESTEND_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/glutton-westend-srtool-digest.json"}
|
||||
PEOPLE_ROCOCO_DIGEST=${PEOPLE_ROCOCO_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/people-rococo-srtool-digest.json"}
|
||||
PEOPLE_WESTEND_DIGEST=${PEOPLE_WESTEND_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/people-westend-srtool-digest.json"}
|
||||
ROCOCO_DIGEST=${ROCOCO_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/rococo-srtool-digest.json"}
|
||||
WESTEND_DIGEST=${WESTEND_DIGEST:-"$PROJECT_ROOT/scripts/release/digests/westend-srtool-digest.json"}
|
||||
|
||||
jq \
|
||||
--slurpfile srtool_asset_hub_rococo $ASSET_HUB_ROCOCO_DIGEST \
|
||||
--slurpfile srtool_asset_hub_westend $ASSET_HUB_WESTEND_DIGEST \
|
||||
--slurpfile srtool_bridge_hub_rococo $BRIDGE_HUB_ROCOCO_DIGEST \
|
||||
--slurpfile srtool_bridge_hub_westend $BRIDGE_HUB_WESTEND_DIGEST \
|
||||
--slurpfile srtool_collectives_westend $COLLECTIVES_WESTEND_DIGEST \
|
||||
--slurpfile srtool_contracts_rococo $CONTRACTS_ROCOCO_DIGEST \
|
||||
--slurpfile srtool_coretime_rococo $CORETIME_ROCOCO_DIGEST\
|
||||
--slurpfile srtool_coretime_westend $CORETIME_WESTEND_DIGEST \
|
||||
--slurpfile srtool_glutton_westend $GLUTTON_WESTEND_DIGEST \
|
||||
--slurpfile srtool_people_rococ $PEOPLE_ROCOCO_DIGEST \
|
||||
--slurpfile srtool_people_westend $PEOPLE_WESTEND_DIGEST \
|
||||
--slurpfile srtool_rococo $ROCOCO_DIGEST \
|
||||
--slurpfile srtool_westend $WESTEND_DIGEST \
|
||||
-n '{
|
||||
srtool: [
|
||||
{ order: 10, name: "Westend", data: $srtool_westend[0] },
|
||||
{ order: 11, name: "Westend AssetHub", data: $srtool_asset_hub_westend[0] },
|
||||
{ order: 12, name: "Westend BridgeHub", data: $srtool_bridge_hub_westend[0] },
|
||||
{ order: 13, name: "Westend Collectives", data: $srtool_collectives_westend[0] },
|
||||
{ order: 14, name: "Westend Coretime", data: $srtool_coretime_westend[0] },
|
||||
{ order: 15, name: "Westend Glutton", data: $srtool_glutton_westend[0] },
|
||||
{ order: 16, name: "Westend People", data: $srtool_people_westend[0] },
|
||||
{ order: 17, name: "Rococo", data: $srtool_rococo[0] },
|
||||
{ order: 18, name: "Rococo AssetHub", data: $srtool_asset_hub_rococo[0] },
|
||||
{ order: 19, name: "Rococo BridgeHub", data: $srtool_bridge_hub_rococo[0] },
|
||||
{ order: 20, name: "Rococo Contracts", data: $srtool_contracts_rococo[0] },
|
||||
{ order: 21, name: "Rococo Coretime", data: $srtool_coretime_rococo[0] },
|
||||
{ order: 22, name: "Rococo People", data: $srtool_people_rococ[0] }
|
||||
] }' > "$PROJECT_ROOT/scripts/release/context.json"
|
||||
|
||||
RELEASE_DIR="$PROJECT_ROOT/scripts/release/"
|
||||
pushd $RELEASE_DIR >/dev/null
|
||||
tera --env --env-key env --include-path templates --template templates/template.md.tera context.json > RELEASE_DRAFT.md
|
||||
popd >/dev/null
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
*.json
|
||||
@@ -0,0 +1,4 @@
|
||||
{# This include generates the section showing the changes #}
|
||||
## Changelog
|
||||
|
||||
{% include "changelog.md" -%}
|
||||
@@ -0,0 +1,6 @@
|
||||
## Rust compiler versions
|
||||
|
||||
This release was built and tested against the following versions of `rustc`.
|
||||
Other versions may work.
|
||||
|
||||
- Rust Stable: `{{ env.RUSTC_STABLE }}`
|
||||
@@ -0,0 +1,26 @@
|
||||
{# This macro shows one runtime #}
|
||||
{%- macro runtime(runtime) -%}
|
||||
|
||||
### {{ runtime.name | title }}
|
||||
|
||||
{%- if runtime.data.runtimes.compressed.subwasm.compression.compressed %}
|
||||
{%- set compressed = "Yes" %}
|
||||
{%- else %}
|
||||
{%- set compressed = "No" %}
|
||||
{%- endif %}
|
||||
|
||||
{%- set comp_ratio = 100 - (runtime.data.runtimes.compressed.subwasm.compression.size_compressed /
|
||||
runtime.data.runtimes.compressed.subwasm.compression.size_decompressed *100) %}
|
||||
|
||||
```
|
||||
🏋️ Runtime Size: {{ runtime.data.runtimes.compressed.subwasm.size | filesizeformat }} ({{
|
||||
runtime.data.runtimes.compressed.subwasm.size }} bytes)
|
||||
🔥 Core Version: {{ runtime.data.runtimes.compressed.subwasm.core_version.specName }}-{{runtime.data.runtimes.compressed.subwasm.core_version.specVersion }} ({{runtime.data.runtimes.compressed.subwasm.core_version.implName }}-{{runtime.data.runtimes.compressed.subwasm.core_version.implVersion }}.tx{{runtime.data.runtimes.compressed.subwasm.core_version.transactionVersion }}.au{{runtime.data.runtimes.compressed.subwasm.core_version.authoringVersion }})
|
||||
🗜 Compressed: {{ compressed }}: {{ comp_ratio | round(method="ceil", precision=2) }}%
|
||||
🎁 Metadata version: V{{ runtime.data.runtimes.compressed.subwasm.metadata_version }}
|
||||
🗳️ system.setCode hash: {{ runtime.data.runtimes.compressed.subwasm.proposal_hash }}
|
||||
🗳️ authorizeUpgrade hash: {{ runtime.data.runtimes.compressed.subwasm.parachain_authorize_upgrade_hash }}
|
||||
🗳️ Blake2-256 hash: {{ runtime.data.runtimes.compressed.subwasm.blake2_256 }}
|
||||
📦 IPFS: {{ runtime.data.runtimes.compressed.subwasm.ipfs_hash }}
|
||||
```
|
||||
{%- endmacro runtime %}
|
||||
@@ -0,0 +1,19 @@
|
||||
{# This include shows the list and details of the runtimes #}
|
||||
{%- import "runtime.md.tera" as m_r -%}
|
||||
|
||||
{# --- #}
|
||||
|
||||
## Runtimes
|
||||
|
||||
{% set rtm = srtool[0] -%}
|
||||
|
||||
The information about the runtimes included in this release can be found below.
|
||||
The runtimes have been built using [{{ rtm.data.gen }}](https://github.com/paritytech/srtool) and `{{ rtm.data.rustc }}`.
|
||||
|
||||
{%- for runtime in srtool | sort(attribute="name") %}
|
||||
{%- set HIDE_VAR = "HIDE_SRTOOL_" ~ runtime.name | upper %}
|
||||
{%- if not env is containing(HIDE_VAR) %}
|
||||
|
||||
{{ m_r::runtime(runtime=runtime) }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
@@ -0,0 +1,9 @@
|
||||
{# This is the entry point of the template -#}
|
||||
|
||||
This release contains the changes from `{{ env.REF1 | replace(from="refs/tags/", to="") }}` to `{{ env.REF2 | replace(from="refs/tags/", to="") }}`.
|
||||
|
||||
{% include "changes.md.tera" -%}
|
||||
|
||||
{% include "compiler.md.tera" -%}
|
||||
|
||||
{% include "runtimes.md.tera" -%}
|
||||
Reference in New Issue
Block a user