Skip to content
Open
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
992ad94
manual release CI workflow
rosarp Feb 12, 2026
c860fbd
removed version & reused spec_version
rosarp Feb 13, 2026
febefa6
added runtime-matrix for variable values
rosarp Feb 13, 2026
b0c4113
Apply suggestion from @bkontur
rosarp Feb 13, 2026
e911380
adding temporary trigger
rosarp Feb 23, 2026
9e21205
fixing format
rosarp Feb 23, 2026
30cf7b0
fixing branchname
rosarp Feb 23, 2026
f3065bd
fixing syntax
rosarp Feb 23, 2026
94010c0
setting default value for testing
rosarp Feb 23, 2026
e334db2
adding change for push trigger
rosarp Feb 23, 2026
07a9efc
fixed parsing
rosarp Feb 23, 2026
9503a69
adding default for push trigger
rosarp Feb 23, 2026
073bacd
fix paths
rosarp Feb 23, 2026
6be95de
fixed paths
rosarp Feb 23, 2026
e301581
fixed paths for runtime_file
rosarp Feb 23, 2026
73b5508
install protoc
rosarp Feb 23, 2026
f11f2fd
added echo for debugging
rosarp Feb 23, 2026
35525bd
select base branch for PR
rosarp Feb 23, 2026
db4fc2f
clean up of 'push' trigger
rosarp Feb 23, 2026
b4877c5
set env variable before run
rosarp Feb 24, 2026
b9c5fc6
temp added defualt to inputs
rosarp Feb 24, 2026
1083dc4
typo
rosarp Feb 24, 2026
8217bea
set defaults
rosarp Feb 24, 2026
ef2d9b6
set defaults for inputs
rosarp Feb 24, 2026
75c8df6
set defaults
rosarp Feb 24, 2026
e2a8257
defaults, fixed typo
rosarp Feb 24, 2026
0184d9c
removed --locked flag for check & clippy
rosarp Feb 24, 2026
800e722
fixing create PR variable expansion
rosarp Feb 24, 2026
fceaf0d
fix syntax
rosarp Feb 24, 2026
fb70fa2
fix: clone master for PR
rosarp Feb 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
252 changes: 252 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
name: Release Relayer

on:
workflow_dispatch:
inputs:
spec_version:
description: 'Spec version number (e.g. v1001006)'
required: true
type: string
runtime:
description: 'Select runtime to download'
required: true
type: choice
options:
- 'BridgeHubPolkadot'
- 'BridgeHubKusama'
- 'AssetHubPolkadot'
- 'AssetHubKusama'
default: 'BridgeHubKusama'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Create wbuild directory
run: mkdir -p ./tools/wbuild

- name: Download runtime files
run: |
spec_version="${{ github.event.inputs.spec_version }}"

# Convert spec version to runtime version (e.g., v1001006 -> v1.1.6)
spec_num="${spec_version#v}"
# Extract major, minor, patch from 7-digit number
major="${spec_num:0:1}"
minor="${spec_num:1:3}"
patch="${spec_num:4:3}"
# Remove leading zeros
minor=$((10#$minor))
patch=$((10#$patch))
runtime_version="v$major.$minor.$patch"

echo "Spec version: $spec_version"
echo "Runtime version: $runtime_version"

# Save runtime version for use in subsequent steps
echo "RUNTIME_VERSION=$runtime_version" >> $GITHUB_ENV

# Download runtime
if [[ "${{ github.event.inputs.runtime }}" == *"BridgeHub Polkadot"* ]]; then
echo "Downloading Polkadot BridgeHub runtime..."
runtime_file="./tools/wbuild/bridge-hub-polkadot_runtime-${runtime_version#v}.compact.compressed.wasm"
wget -O "$runtime_file" \
"https://github.com/polkadot-fellows/runtimes/releases/download/${runtime_version}/bridge-hub-polkadot_runtime-${runtime_version#v}.compact.compressed.wasm"
else if [[ "${{ github.event.inputs.runtime }}" == *"BridgeHub Kusama"* ]]; then
echo "Downloading Kusama BridgeHub runtime..."
runtime_file="./tools/wbuild/bridge-hub-kusama_runtime-${runtime_version#v}.compact.compressed.wasm"
wget -O "$runtime_file" \
"https://github.com/polkadot-fellows/runtimes/releases/download/${runtime_version}/bridge-hub-kusama_runtime-${runtime_version#v}.compact.compressed.wasm"
else if [[ "${{ github.event.inputs.runtime }}" == *"AssetHub Polkadot"* ]]; then
echo "Downloading Polkadot AssetHub runtime..."
runtime_file="./tools/wbuild/asset-hub-polkadot_runtime-${runtime_version#v}.compact.compressed.wasm"
wget -O "$runtime_file" \
"https://github.com/polkadot-fellows/runtimes/releases/download/${runtime_version}/asset-hub-polkadot_runtime-${runtime_version#v}.compact.compressed.wasm"
else if [[ "${{ github.event.inputs.runtime }}" == *"AssetHub Kusama"* ]]; then
echo "Downloading Kusama AssetHub runtime..."
runtime_file="./tools/wbuild/asset-hub-kusama_runtime-${runtime_version#v}.compact.compressed.wasm"
wget -O "$runtime_file" \
"https://github.com/polkadot-fellows/runtimes/releases/download/${runtime_version}/asset-hub-kusama_runtime-${runtime_version#v}.compact.compressed.wasm"
else
echo "Invalid runtime selected. Aborting download."
exit 1
fi

# Check if file was downloaded successfully
if [[ ! -f "$runtime_file" ]]; then
echo "Error: Failed to download runtime file: $runtime_file"
echo "Aborting workflow."
exit 1
fi

echo "Successfully downloaded: $runtime_file"
ls -lh "$runtime_file"

# Set environment variables for next steps
echo "RUNTIME_FILE=$runtime_file" >> $GITHUB_ENV
echo "RUNTIME_NAME=${{ github.event.inputs.runtime }}" >> $GITHUB_ENV
echo "SPEC_VERSION=${{ github.event.inputs.spec_version }}" >> $GITHUB_ENV

- name: Update spec version in client files
run: |
# Convert spec version format (e.g., v1001006 -> 1_001_006)
spec_num="${SPEC_VERSION#v}"
formatted_spec=$(echo "$spec_num" | sed 's/\([0-9]\)\([0-9]\{3\}\)\([0-9]\{3\}\)/\1_\2_\3/')

echo "Updating spec version $SPEC_VERSION to: $formatted_spec"

# Update spec version based on runtime selection
case "$RUNTIME_NAME" in
"BridgeHubPolkadot")
sed -i "s/spec_version: [0-9_]*/spec_version: $formatted_spec/" relay-clients/client-bridge-hub-polkadot/src/lib.rs
;;
"BridgeHubKusama")
sed -i "s/spec_version: [0-9_]*/spec_version: $formatted_spec/" relay-clients/client-bridge-hub-kusama/src/lib.rs
;;
"AssetHubPolkadot")
sed -i "s/spec_version: [0-9_]*/spec_version: $formatted_spec/" relay-clients/client-asset-hub-polkadot/src/lib.rs
;;
"AssetHubKusama")
sed -i "s/spec_version: [0-9_]*/spec_version: $formatted_spec/" relay-clients/client-asset-hub-kusama/src/lib.rs
;;
esac

- name: Bump minor version in Cargo.toml
run: |
# Get current version and bump minor version
current_version=$(grep '^version = ' substrate-relay/Cargo.toml | cut -d'"' -f2)
major=$(echo "$current_version" | cut -d. -f1)
minor=$(echo "$current_version" | cut -d. -f2)
patch=$(echo "$current_version" | cut -d. -f3)

# Increment patch version
new_patch=$((patch + 1))
new_version="$major.$minor.$new_patch"

echo "Bumping relayer version from $current_version to $new_version"
sed -i "s/version = \"$current_version\"/version = \"$new_version\"/" substrate-relay/Cargo.toml

- name: Run runtime codegen
run: |
# Extract runtime filename from RUNTIME_FILE
runtime_filename=$(basename "$RUNTIME_FILE")

# Determine target client directory based on runtime
case "$RUNTIME_NAME" in
"BridgeHubPolkadot")
target_dir="relay-clients/client-bridge-hub-polkadot/src"
;;
"BridgeHubKusama")
target_dir="relay-clients/client-bridge-hub-kusama/src"
;;
"AssetHubPolkadot")
target_dir="relay-clients/client-asset-hub-polkadot/src"
;;
"AssetHubKusama")
target_dir="relay-clients/client-asset-hub-kusama/src"
;;
esac

echo "Running runtime codegen for $runtime_filename"
cargo run --bin runtime-codegen --release -- --from-wasm-file "wbuild/$runtime_filename" | tee "$target_dir/codegen_runtime.rs"

- name: Fix Header generic types & Format code
run: |
cargo +nightly fmt --all
find . -name codegen_runtime.rs -exec \
sed -i 's/::sp_runtime::generic::Header<::core::primitive::u32>/::sp_runtime::generic::Header<::core::primitive::u32, ::sp_runtime::traits::BlakeTwo256>/g' {} +
cargo +nightly fmt --all

echo "Cargo check"
SKIP_WASM_BUILD=1 cargo check --workspace --target-dir=target/rust-analyzer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to run this with --locked

Copy link
Member Author

@rosarp rosarp Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need new lock file updated after version bump.
Also, --lock failed the build - https://github.com/rosarp/parity-bridges-common/actions/runs/22340517046/job/64642574979#step:10:25

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What and why this --target-dir=target/rust-analyzer?

Copy link
Member Author

@rosarp rosarp Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied from my local commands collection! I use it to avoid blocking builds.

--target-dir=target/rust-analyzer
I have removed it.


echo "Cargo clippy"
SKIP_WASM_BUILD=1 cargo clippy --workspace --all-targets --all-features --target-dir=target/rust-analyzer

- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
Update runtime: ${{ github.event.inputs.runtime }} ${{ env.RUNTIME_VERSION }}

- Update spec version to ${{ github.event.inputs.spec_version }}
- Bump substrate-relay version to ${{ env.RUNTIME_VERSION }}
- Regenerate runtime code
title: "Update runtime: ${{ github.event.inputs.runtime }} ${{ env.RUNTIME_VERSION }}"
body: |
Automated runtime update:

- Runtime: ${{ github.event.inputs.runtime }}
- Spec Version: ${{ github.event.inputs.spec_version }}

Changes:
- Updated spec version in client files
- Bumped substrate-relay minor version
- Regenerated runtime code
- Applied formatting fixes
branch: runtime-update-${{ github.event.inputs.runtime }}-${{ env.RUNTIME_VERSION }}
delete-branch: true

create-tag:
runs-on: ubuntu-latest
needs: release
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this workflow run in workflow_dispatch? It would need a pull_request trigger for this condition to ever be true, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two stages.

  1. release - it is manually triggered which uses 2 inputs.
  2. create-tag - this is triggered when 'release' at the end creates a PR. When this PR is closed & merged, then it will trigger and create a tag.

steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Get version from merged PR
id: get-version
run: |
# Extract version from PR title or branch name
if [[ "${{ github.event.pull_request.title }}" =~ Update\ runtime:\ .+\ (.+) ]]; then
version="${BASH_REMATCH[1]}"
else
# Fallback to branch name
version=$(echo "${{ github.event.pull_request.head.ref }}" | sed 's/runtime-update-.*-//')
fi
echo "version=$version" >> $GITHUB_OUTPUT
echo "Detected version: $version"

- name: Get new substrate-relay version
id: get-cargo-version
run: |
# Read the current version from Cargo.toml
version=$(grep '^version = ' substrate-relay/Cargo.toml | cut -d'"' -f2)
echo "cargo_version=$version" >> $GITHUB_OUTPUT
echo "Cargo version: $version"

- name: Create and push tag
run: |
version="${{ steps.get-version.outputs.version }}"
cargo_version="${{ steps.get-cargo-version.outputs.cargo_version }}"
tag_name="v$cargo_version"

echo "Creating tag: $tag_name"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git tag -a "$tag_name" -m "Release $tag_name - Runtime: $version - Substrate-relay: $cargo_version"

git push origin "$tag_name"

- name: Create Release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rosarp maybe we should create release only when "build-tag.yml" finished and new docker is pushed or something like that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkontur creating tag , builds image. but also after build-tag.yml there is another image created right?
Do we need it built twice?

Either this can be moved to build-tag.yml job itself.
or we can keep it manual, like we have right now, as it needs to auto generate changes. Not sure right now if that can be automated in workflow itself. This is currently missing here.

In either case, removing it from here.

uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get-cargo-version.outputs.cargo_version }}
release_name: Release v${{ steps.get-cargo-version.outputs.cargo_version }}
body: |
Automated release v${{ steps.get-cargo-version.outputs.cargo_version }}

This release includes runtime updates from the merged PR:
- Runtime: ${{ github.event.pull_request.title }}
- Substrate-relay version: ${{ steps.get-cargo-version.outputs.cargo_version }}
draft: false
prerelease: false
Loading