Cut Release v0.0.1 #1064
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Release | |
run-name: Cut Release ${{github.event.inputs.release-version || github.ref_name}} | |
concurrency: | |
group: ${{github.workflow}}-${{github.ref}} | |
cancel-in-progress: false | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" # ex. v1.0.0 | |
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" # ex. v1.1.0-rc1 | |
- "v0.0.1" # used for testing only | |
- "v0.0.1-rc[0-9]+" # used for testing only | |
workflow_dispatch: | |
inputs: | |
release-version: | |
description: "Release version (v#.#.#[-rc#])" | |
required: true | |
permissions: | |
contents: write | |
statuses: write | |
env: | |
NEW_RELEASE_TAG_FROM_UI: ${{github.event.inputs.release-version}} | |
NEW_RELEASE_TAG: ${{github.event.inputs.release-version || github.ref_name}} | |
RELEASE_BRANCH_NAME: release-${{github.event.inputs.release-version || github.ref_name}} | |
LATEST_FULL_RELEASE_TAG: _LATEST-FULL-RELEASE | |
TEST_RUN: ${{startsWith(github.event.inputs.release-version || github.ref_name, 'v0.0.1')}} | |
RUST_TOOLCHAIN: "1.76.0" # Match to /rust-toolchain.toml | |
jobs: | |
validate-release-version: | |
name: Validate Release Version | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Validate | |
if: env.NEW_RELEASE_TAG_FROM_UI != '' | |
shell: bash | |
run: | | |
version=${{env.NEW_RELEASE_TAG_FROM_UI}} | |
echo "Release version entered in UI: $version" | |
regex='^v([0-9]+)\.(0|([1-9][0-9]*))\.(0|([1-9][0-9]*))(-rc[1-9][0-9]*)?$' | |
if [[ ! $version =~ $regex ]]; then | |
echo "ERROR: Entered version $version is not valid." | |
echo "Please use v#.#.#[-rc#] format." | |
exit 1 | |
fi | |
create-release-branch: | |
needs: validate-release-version | |
name: Create Release Branch | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create Release Branch? | |
id: create-release-branch | |
run: | | |
set -x | |
full_branch=remotes/origin/${{env.RELEASE_BRANCH_NAME}} | |
branch_hash=$(git rev-parse --verify --quiet $full_branch || echo "") | |
create_branch=$([ -z $branch_hash ] && echo 'true' || echo 'false') | |
echo "create_branch: $create_branch" | |
echo "create=$create_branch" >> $GITHUB_OUTPUT | |
- name: Create Release Branch | |
if: steps.create-release-branch.outputs.create == 'true' | |
run: | | |
git status -s | |
git checkout -b ${{env.RELEASE_BRANCH_NAME}} | |
git push origin ${{env.RELEASE_BRANCH_NAME}} -u | |
run-all-benchmarks: | |
needs: create-release-branch | |
name: Run All Benchmarks | |
runs-on: [self-hosted, Linux, X64, benchmark] | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{env.RELEASE_BRANCH_NAME}} | |
- name: Full Release? | |
id: is-full-release | |
uses: ./.github/workflows/common/is-full-release | |
with: | |
version-tag: ${{env.NEW_RELEASE_TAG}} | |
- name: Install Required Packages | |
if: steps.is-full-release.outputs.is-full-release == 'true' | |
run: | | |
sudo apt-get update | |
sudo apt install -y protobuf-compiler libclang-dev clang cmake | |
- name: Install Rust Toolchain | |
if: steps.is-full-release.outputs.is-full-release == 'true' | |
# Match installation steps to CI base docker image | |
run: | | |
curl https://sh.rustup.rs -sSf | HOME=`pwd` bash -s -- -y | |
echo "PATH=`pwd`/.cargo/bin:$PATH" >> $GITHUB_ENV | |
- name: Update Weights for All Pallets | |
if: steps.is-full-release.outputs.is-full-release == 'true' | |
run: | | |
rustup show | |
make benchmarks | |
git status -s | |
git diff | |
- name: Commit Updated Weights | |
if: steps.is-full-release.outputs.is-full-release == 'true' | |
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 | |
with: | |
commit_message: "Update weights for release ${{env.NEW_RELEASE_TAG}}" | |
file_pattern: "pallets/**/*.rs runtime/common/src/weights/*" | |
version-code: | |
needs: run-all-benchmarks | |
name: Version Code | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{env.RELEASE_BRANCH_NAME}} | |
fetch-depth: 0 | |
- name: Version Code | |
shell: bash | |
run: | | |
release_version=${{env.NEW_RELEASE_TAG}} | |
make version v=${release_version:1} | |
- name: Print Updated Version | |
run: | | |
git status | |
git diff | |
- name: Commit Updated Version | |
id: commit-updated-version | |
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 | |
with: | |
commit_message: "Update versions for release ${{env.NEW_RELEASE_TAG}}" | |
- name: Update Release Version Tag | |
uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 | |
with: | |
tag: ${{env.NEW_RELEASE_TAG}} | |
force_push_tag: true | |
message: "Release version tag" | |
commit_sha: ${{steps.commit-updated-version.outputs.commit_hash}} | |
build-binaries: | |
needs: version-code | |
name: Build ${{matrix.arch}} Binary for ${{matrix.network}} | |
strategy: | |
fail-fast: true | |
matrix: | |
network: [dev, local, testnet, mainnet] | |
arch: [amd64] | |
include: | |
- network: dev | |
spec: frequency-no-relay | |
build-profile: release | |
release-file-name-prefix: frequency-dev | |
- network: local | |
spec: frequency-local | |
build-profile: release | |
release-file-name-prefix: frequency-local | |
- network: testnet | |
spec: frequency-testnet | |
build-profile: release | |
release-file-name-prefix: frequency-testnet | |
- network: mainnet | |
spec: frequency | |
build-profile: release | |
release-file-name-prefix: frequency | |
runs-on: ubicloud-standard-8 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
env: | |
SIGNING_SUBKEY_FINGERPRINT: B6327D1474C6392032870E8EFA4FD1E73A0FE707 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{env.RELEASE_BRANCH_NAME}} | |
- name: Set Env Vars | |
run: | | |
echo "BIN_DIR=target/${{matrix.build-profile}}" >> $GITHUB_ENV | |
echo "BUILT_BIN_FILENAME=frequency" >> $GITHUB_ENV | |
echo "RELEASE_BIN_FILENAME=${{matrix.release-file-name-prefix}}.${{matrix.arch}}" >> $GITHUB_ENV | |
- name: Compile for ${{matrix.network}} | |
run: | | |
CARGO_INCREMENTAL=0 RUSTFLAGS="-D warnings" cargo build \ | |
--locked \ | |
--features ${{matrix.spec}} \ | |
--profile ${{matrix.build-profile}} | |
- name: Run Sanity Checks | |
run: | | |
file ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} && \ | |
${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} --version | |
- name: Rename Binary | |
run: | | |
cp -p ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} \ | |
${{env.BIN_DIR}}/${{env.RELEASE_BIN_FILENAME}} | |
- name: Generate Binary Hash | |
working-directory: ${{env.BIN_DIR}} | |
run: sha256sum ${{env.RELEASE_BIN_FILENAME}} > ${{env.RELEASE_BIN_FILENAME}}.sha256 | |
- name: Import GPG key | |
id: import-gpg | |
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 | |
with: | |
gpg_private_key: ${{secrets.FREQUENCY_PGP_SECRET_SUBKEYS}} | |
passphrase: ${{secrets.FREQUENCY_PGP_MASTER_KEY_PASSWORD}} | |
fingerprint: ${{env.SIGNING_SUBKEY_FINGERPRINT}} | |
- name: List GPG Keys | |
run: gpg -k; gpg -K | |
# The error in this step may be due to expired signing subkey | |
# See https://github.com/frequency-chain/frequency/issues/1695 | |
- name: Generate Binary Signature | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
gpg --version | |
gpg --local-user ${{env.SIGNING_SUBKEY_FINGERPRINT}} \ | |
--sign --armor \ | |
--pinentry-mode=loopback \ | |
--passphrase="${{secrets.FREQUENCY_PGP_MASTER_KEY_PASSWORD}}" \ | |
--detach-sig \ | |
${{env.RELEASE_BIN_FILENAME}} | |
- name: Verify Binary | |
working-directory: ${{env.BIN_DIR}} | |
run: gpg --verify ${{env.RELEASE_BIN_FILENAME}}.asc | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-binary-${{matrix.network}}-${{github.run_id}} | |
path: | | |
${{env.BIN_DIR}}/${{env.RELEASE_BIN_FILENAME}} | |
${{env.BIN_DIR}}/${{env.RELEASE_BIN_FILENAME}}.sha256 | |
${{env.BIN_DIR}}/${{env.RELEASE_BIN_FILENAME}}.asc | |
if-no-files-found: error | |
build-runtimes: | |
needs: version-code | |
name: Build Runtime for ${{matrix.network}} | |
outputs: | |
runtime_filename_dev: ${{steps.set-env-vars.outputs.runtime_filename_dev}} | |
runtime_filename_paseo: ${{steps.set-env-vars.outputs.runtime_filename_paseo}} | |
runtime_filename_mainnet: ${{steps.set-env-vars.outputs.runtime_filename_mainnet}} | |
# env: | |
# HOME: /root | |
strategy: | |
fail-fast: true | |
matrix: | |
# Remember, runtimes are separate for each relay chain | |
# We do not release frequency-*-local runtimes however | |
network: [dev, paseo, mainnet] | |
include: | |
- network: dev | |
build-profile: release | |
package: frequency-runtime | |
runtime-dir: runtime/frequency | |
built-wasm-file-name-prefix: frequency_runtime | |
release-wasm-file-name-prefix: frequency-dev_runtime | |
features: frequency-no-relay | |
wasm-core-version: frequency-testnet | |
- network: paseo | |
build-profile: release | |
package: frequency-runtime | |
runtime-dir: runtime/frequency | |
built-wasm-file-name-prefix: frequency_runtime | |
release-wasm-file-name-prefix: frequency-paseo_runtime | |
features: frequency-testnet | |
wasm-core-version: frequency-testnet | |
- network: mainnet | |
build-profile: release | |
package: frequency-runtime | |
runtime-dir: runtime/frequency | |
built-wasm-file-name-prefix: frequency_runtime | |
release-wasm-file-name-prefix: frequency_runtime | |
features: frequency | |
wasm-core-version: frequency | |
runs-on: ubicloud-standard-8 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{env.RELEASE_BRANCH_NAME}} | |
- name: Install Rust Toolchain | |
# Match installation steps to CI base docker image | |
run: | | |
curl https://sh.rustup.rs -sSf | bash -s -- -y | |
echo "PATH=$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV | |
- name: Extract Runtime Spec Version | |
run: | | |
echo "RUNTIME_SPEC_VERSION=$(awk '/spec_version:/ {match($0, /[0-9]+/); print substr($0, RSTART, RLENGTH); exit}' \ | |
${{matrix.runtime-dir}}/src/lib.rs)" >> $GITHUB_ENV | |
- name: Validate Extracted Version | |
shell: bash | |
run: | | |
echo "Runtime Spec Version: ${{env.RUNTIME_SPEC_VERSION}}" | |
[[ $RUNTIME_SPEC_VERSION == ?(-)+([0-9]) ]] || \ | |
(echo "ERROR: \"${{env.RUNTIME_SPEC_VERSION}}\" is not a valid integer" && exit 1) | |
- name: Set Env Vars | |
id: set-env-vars | |
run: | | |
echo "WASM_DIR=${{matrix.runtime-dir}}/target/srtool/${{matrix.build-profile}}/wbuild/${{matrix.package}}" >> $GITHUB_ENV | |
echo "BUILT_WASM_FILENAME=${{matrix.built-wasm-file-name-prefix}}.compact.compressed.wasm" >> $GITHUB_ENV | |
release_wasm_filename=${{matrix.release-wasm-file-name-prefix}}-v${{env.RUNTIME_SPEC_VERSION}}.${{env.NEW_RELEASE_TAG}}.compact.compressed.wasm | |
echo "RELEASE_WASM_FILENAME=$release_wasm_filename" >> $GITHUB_ENV | |
echo "runtime_filename_${{matrix.network}}=$release_wasm_filename" >> $GITHUB_OUTPUT | |
- name: Build Deterministic WASM | |
id: srtool_build | |
uses: ./.github/workflows/common/srtool | |
env: | |
BUILD_OPTS: "--features on-chain-release-build,no-metadata-docs,${{matrix.features}}" | |
with: | |
profile: ${{matrix.build-profile}} | |
package: ${{matrix.package}} | |
chain: ${{matrix.chain}} | |
tag: "1.77.0" | |
runtime_dir: ${{ matrix.runtime-dir }} | |
- name: Rename WASM file | |
run: | | |
cp -p ${{ steps.srtool_build.outputs.wasm_compressed }} \ | |
./${{env.WASM_DIR}}/${{env.RELEASE_WASM_FILENAME}} | |
- name: Install Subwasm | |
run: | | |
cargo install --locked --git https://github.com/chevdor/subwasm --tag v0.20.0 --force | |
subwasm --version | |
- name: Test WASM file | |
run: | | |
file ${{env.WASM_DIR}}/${{env.RELEASE_WASM_FILENAME}} | |
subwasm info ${{env.WASM_DIR}}/${{env.RELEASE_WASM_FILENAME}} | |
subwasm info ${{env.WASM_DIR}}/${{env.RELEASE_WASM_FILENAME}} | grep "Core version:.*${{matrix.wasm-core-version}}-${{env.RUNTIME_SPEC_VERSION}}" || \ | |
(echo "ERROR: WASM Core version didn't match ${{matrix.wasm-core-version}}-${{env.RUNTIME_SPEC_VERSION}}" && exit 1) | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-wasm-${{matrix.network}}-${{github.run_id}} | |
path: ${{env.WASM_DIR}}/${{env.RELEASE_WASM_FILENAME}} | |
if-no-files-found: error | |
build-rust-developer-docs: | |
needs: version-code | |
name: Build Rust Developer Docs | |
runs-on: ubicloud-standard-4 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{env.RELEASE_BRANCH_NAME}} | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Build Docs | |
run: | | |
RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo doc --no-deps --workspace --features frequency | |
- name: Fix file permissions | |
shell: sh | |
run: | | |
chmod -c -R +rX "target/doc" | | |
while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
- name: Upload Docs | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./target/doc | |
build-js-api-augment: | |
needs: build-binaries | |
name: Build JS API Augment | |
env: | |
NETWORK: local | |
BUILD_PROFILE: release | |
BIN_DIR: target/release | |
RELEASE_FILENAME_PREFIX: frequency-local | |
ARCH: amd64 | |
runs-on: ubuntu-22.04 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
steps: | |
- name: Set Env Vars | |
run: | | |
echo "BIN_DIR=target/${{env.BUILD_PROFILE}}" >> $GITHUB_ENV | |
echo "RELEASE_BIN_FILENAME=${{env.RELEASE_FILENAME_PREFIX}}.${{env.ARCH}}" >> $GITHUB_ENV | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{env.RELEASE_BRANCH_NAME}} | |
- name: Set up NodeJs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
registry-url: "https://registry.npmjs.org" | |
cache-dependency-path: js/api-augment/package-lock.json | |
- name: Install | |
run: npm install # DO NOT use `npm ci` as we want the latest polkadot/api possible | |
working-directory: js/api-augment | |
- name: Download Binaries | |
id: download-binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-binary-${{env.NETWORK}}-${{github.run_id}} | |
path: . | |
- name: Extract and List Downloaded Binaries | |
run: | | |
download_dir=${{steps.download-binaries.outputs.download-path}} | |
mv "${download_dir}"/artifacts*/* "${download_dir}" | |
echo "Download dir: $download_dir" | |
echo "Downloaded binaries: $(ls -l $download_dir)" | |
- name: Move Binary to Target Dir | |
run: | | |
mkdir -p ${{env.BIN_DIR}} | |
mv ${{env.RELEASE_BIN_FILENAME}} ${{env.BIN_DIR}} | |
chmod 755 ${{env.BIN_DIR}}/${{env.RELEASE_BIN_FILENAME}} | |
- name: Output Metadata | |
run: ${{env.BIN_DIR}}/${{env.RELEASE_BIN_FILENAME}} export-metadata --chain=frequency-paseo-local --tmp ./js/api-augment/metadata.json | |
- name: Build | |
run: | | |
npm run build | |
working-directory: js/api-augment | |
- name: Upload Dist Dir | |
uses: actions/upload-artifact@v4 | |
with: | |
name: js-api-augment-${{github.run_id}} | |
path: js/api-augment/dist | |
if-no-files-found: error | |
test-version-matches-release: | |
needs: build-binaries | |
name: Test Version Matches Release | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-22.04] | |
network: [mainnet] | |
include: | |
- network: mainnet | |
spec: frequency | |
build-profile: release | |
release-file-name-prefix: frequency | |
- os: ubuntu-22.04 | |
arch: amd64 | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Set Env Vars | |
run: | | |
echo "BIN_DIR=target/${{matrix.build-profile}}" >> $GITHUB_ENV | |
echo "BUILT_BIN_FILENAME=frequency" >> $GITHUB_ENV | |
echo "RELEASE_BIN_FILENAME=${{matrix.release-file-name-prefix}}.${{matrix.arch}}" >> $GITHUB_ENV | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{env.RELEASE_BRANCH_NAME}} | |
fetch-depth: 0 | |
- name: Download Binaries | |
id: download-binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-binary-${{matrix.network}}-${{github.run_id}} | |
path: . | |
- name: Extract and List Downloaded Binaries | |
run: | | |
download_dir=${{steps.download-binaries.outputs.download-path}} | |
mv "${download_dir}"/artifacts*/* "${download_dir}" | |
echo "Download dir: $download_dir" | |
echo "Downloaded binaries: $(ls -l $download_dir)" | |
- name: Move Binary to Target Dir | |
run: | | |
mkdir -p ${{env.BIN_DIR}} | |
mv ${{env.RELEASE_BIN_FILENAME}} ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} | |
chmod +x ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} | |
- name: Testing Version Match | |
if: env.TEST_RUN != 'true' | |
shell: bash | |
run: | | |
EXPECTED_VERSION="${{env.NEW_RELEASE_TAG}}+polkadot$(make version-polkadot)" | |
ACTUAL_VERSION="v$(${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} --version | cut -d " " -f 2)" | |
echo "Expected: ${EXPECTED_VERSION}" | |
echo " Actual: ${ACTUAL_VERSION%-*}" | |
[[ ${ACTUAL_VERSION%-*} == ${EXPECTED_VERSION} ]] | |
# Could not port this job to container because the reference node will be started in a | |
# parallel container to the job polkadot-js-tools container and the latter will not | |
# be able to connect to the former without runner supporting DinD mode first. | |
# See https://github.com/frequency-chain/frequency/issues/1543 | |
compare-metadata: | |
needs: build-binaries | |
name: Compare Metadata | |
runs-on: ubuntu-22.04 | |
env: | |
NETWORK: mainnet | |
BIN_DIR: target/release | |
BIN_FILENAME: frequency.amd64 | |
TEST_BIN_FILENAME: frequency.amd64 | |
TEST_DOWNLOAD_DIR: download-test | |
REF_BIN_FILENAME: frequency-ref.amd64 | |
REF_DOWNLOAD_DIR: download-ref | |
OUTPUT_DIR: target/release | |
FREQUENCY_PROCESS_NAME: frequency | |
steps: | |
- name: Set Env Vars | |
run: | | |
echo "OUTPUT_FILENAME=metadata-compare-$NETWORK.txt" >> $GITHUB_ENV | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{env.RELEASE_BRANCH_NAME}} | |
fetch-depth: 0 | |
- name: Get Previous Full Release Version | |
id: get-previous-full-release-version | |
uses: ./.github/workflows/common/get-previous-full-release-version | |
with: | |
full-release-version-tag: ${{env.LATEST_FULL_RELEASE_TAG}} | |
- name: Fetch Reference Binary | |
uses: robinraju/release-downloader@c39a3b234af58f0cf85888573d361fb6fa281534 | |
with: | |
tag: ${{steps.get-previous-full-release-version.outputs.version}} | |
fileName: ${{env.BIN_FILENAME}} | |
out-file-path: ${{env.REF_DOWNLOAD_DIR}} | |
- name: Download Test Binary | |
id: download-binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-binary-${{env.NETWORK}}-${{github.run_id}} | |
path: ${{env.TEST_DOWNLOAD_DIR}} | |
- name: Rename and Move Binaries | |
run: | | |
download_dir=${{steps.download-binaries.outputs.download-path}} | |
mv "${download_dir}"/artifacts*/* "${download_dir}" | |
echo "Download dir: $download_dir" | |
echo "Downloaded binaries: $(ls -l $download_dir)" | |
mkdir -p ${{env.BIN_DIR}} | |
mv ${{env.REF_DOWNLOAD_DIR}}/${{env.BIN_FILENAME}} ${{env.BIN_DIR}}/${{env.REF_BIN_FILENAME}} | |
mv ${{env.TEST_DOWNLOAD_DIR}}/${{env.BIN_FILENAME}} ${{env.BIN_DIR}}/${{env.TEST_BIN_FILENAME}} | |
- name: Set Binary Permissions | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
chmod 755 $TEST_BIN_FILENAME | |
chmod 755 $REF_BIN_FILENAME | |
- name: Docker network | |
run: docker network create net-${{env.RELEASE_BRANCH_NAME}} | |
- name: Start Test Node | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
docker run -d --rm --net=net-${{env.RELEASE_BRANCH_NAME}} \ | |
-v `pwd`:/app \ | |
--name test-node \ | |
ubuntu:22.04 \ | |
/bin/sh -c "chmod +x /app/${{env.TEST_BIN_FILENAME}} && /app/${{env.TEST_BIN_FILENAME}} \ | |
--chain=frequency-bench \ | |
--rpc-external \ | |
--rpc-cors=all \ | |
--rpc-methods=Unsafe \ | |
--no-telemetry \ | |
--no-prometheus \ | |
--reserved-only \ | |
--no-hardware-benchmarks \ | |
--tmp \ | |
-- \ | |
--reserved-only" | |
- name: Start Reference Node | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
docker run -d --rm --net=net-${{env.RELEASE_BRANCH_NAME}} \ | |
-v `pwd`:/app \ | |
--name ref-node \ | |
ubuntu:22.04 \ | |
/bin/sh -c "chmod +x /app/${{env.REF_BIN_FILENAME}} && /app/${{env.REF_BIN_FILENAME}} \ | |
--chain=frequency-bench \ | |
--rpc-external \ | |
--rpc-cors=all \ | |
--rpc-methods=Unsafe \ | |
--no-telemetry \ | |
--no-prometheus \ | |
--reserved-only \ | |
--no-hardware-benchmarks \ | |
--tmp \ | |
-- \ | |
--reserved-only" | |
- name: Prepare Output | |
working-directory: ${{env.OUTPUT_DIR}} | |
run: | | |
REF_VERSION=$(./${{env.REF_BIN_FILENAME}} --version) | |
BIN_VERSION=$(./${{env.TEST_BIN_FILENAME}} --version) | |
echo "Metadata comparison against previous full release:" >> ${{env.OUTPUT_FILENAME}} | |
echo "Date: $(date)" >> ${{env.OUTPUT_FILENAME}} | |
echo "Ref. version: $REF_VERSION" >> ${{env.OUTPUT_FILENAME}} | |
echo "Test version: $BIN_VERSION" >> ${{env.OUTPUT_FILENAME}} | |
echo "----------------------------------------------------------------------" >> ${{env.OUTPUT_FILENAME}} | |
- name: Compare Metadata | |
timeout-minutes: 10 | |
run: | | |
CMD="docker run --pull always --net=net-${{env.RELEASE_BRANCH_NAME}} jacogr/polkadot-js-tools:0.57.1 metadata ws://ref-node:9944 ws://test-node:9944" | |
echo -e "Running:\n$CMD" | |
$CMD >> ${{env.OUTPUT_DIR}}/${{env.OUTPUT_FILENAME}} | |
cat ${{env.OUTPUT_DIR}}/${{env.OUTPUT_FILENAME}} | egrep -n -i '' | |
SUMMARY=$(./tools/ci/scripts/extrinsic-ordering-filter.sh ${{env.OUTPUT_DIR}}/${{env.OUTPUT_FILENAME}}) | |
echo -e "$SUMMARY" | |
echo -e "$SUMMARY" >> ${{env.OUTPUT_DIR}}/${{env.OUTPUT_FILENAME}} | |
- name: Show Result | |
working-directory: ${{env.OUTPUT_DIR}} | |
run: | | |
cat ${{env.OUTPUT_FILENAME}} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-metadata-${{github.run_id}} | |
path: ${{env.OUTPUT_DIR}}/${{env.OUTPUT_FILENAME}} | |
if-no-files-found: error | |
- name: Stop Local Nodes | |
if: always() | |
run: | | |
echo "Attempting to kill all frequency processes..." | |
docker stop ref-node || true | |
docker stop test-node || true | |
docker network rm net-${{env.RELEASE_BRANCH_NAME}} | |
wait-for-all-builds: | |
needs: | |
[ | |
build-binaries, | |
build-runtimes, | |
compare-metadata, | |
test-version-matches-release, | |
build-rust-developer-docs, | |
build-js-api-augment, | |
] | |
name: Wait for All Builds to Finish | |
runs-on: ubuntu-22.04 | |
outputs: | |
runtime_filename_dev: ${{needs.build-runtimes.outputs.runtime_filename_dev}} | |
runtime_filename_mainnet: ${{needs.build-runtimes.outputs.runtime_filename_mainnet}} | |
runtime_filename_paseo: ${{needs.build-runtimes.outputs.runtime_filename_paseo}} | |
steps: | |
- name: Proceed Forward | |
run: echo "All build jobs have finished, proceeding with the release" | |
release-artifacts: | |
needs: wait-for-all-builds | |
name: Release Built Artifacts | |
runs-on: ubuntu-22.04 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
permissions: | |
contents: write | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{env.RELEASE_BRANCH_NAME}} | |
fetch-depth: 0 | |
- name: Full Release? | |
id: is-full-release | |
uses: ./.github/workflows/common/is-full-release | |
with: | |
version-tag: ${{env.NEW_RELEASE_TAG}} | |
- name: Get Previous Full Release Version | |
id: get-previous-full-release-version | |
uses: ./.github/workflows/common/get-previous-full-release-version | |
with: | |
full-release-version-tag: ${{env.LATEST_FULL_RELEASE_TAG}} | |
- name: Set Env Vars | |
run: | | |
echo "PREVIOUS_RELEASE_TAG=${{steps.get-previous-full-release-version.outputs.version}}" >> $GITHUB_ENV | |
- name: Install Tera CLI | |
run: | | |
cargo install --locked --git https://github.com/chevdor/tera-cli | |
echo "PATH=$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV | |
- name: Verify Tera CLI Install | |
run: | | |
which tera | |
tera --version | |
- name: Build Changelog | |
id: build-changelog | |
uses: mikepenz/release-changelog-builder-action@f3fc77b47b74e78971fffecb2102ae6eac9a44d6 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
fromTag: ${{env.PREVIOUS_RELEASE_TAG}} | |
toTag: ${{env.NEW_RELEASE_TAG}} | |
configurationJson: | | |
{ | |
"categories": [ | |
{ | |
"title": "### Breaking Changes|n|", | |
"labels": ["change/breaking"] | |
}, | |
{ | |
"title": "### Major Changes|n|", | |
"labels": ["change/major"] | |
}, | |
{ | |
"title": "### Storage Migrations|n|", | |
"labels": ["change/storage-migration"] | |
} | |
], | |
"template": "#{{CHANGELOG}}|n||n|### Additional Changes|n||n| #{{UNCATEGORIZED}}", | |
"pr_template": "- #{{TITLE}} ##{{NUMBER}}", | |
"empty_template": "- No changes", | |
"transformers": [ | |
{ | |
"pattern": "- (.*)", | |
"target": "- $1|n|" | |
} | |
] | |
} | |
- name: Sanitize Changelog | |
id: sanitize-changelog | |
shell: bash | |
env: | |
CHANGELOG: ${{steps.build-changelog.outputs.changelog}} | |
run: | | |
echo "-------------------------------------------------" | |
clean="${CHANGELOG//[\`\[\]$'\n']/}" | |
echo "sanitized: $clean" | |
echo "sanitized=$clean" >> $GITHUB_OUTPUT | |
- name: Get Polkadot Version | |
id: polkadot-version | |
run: echo "version=$(make version-polkadot)" >> $GITHUB_OUTPUT | |
- name: Download Artifacts | |
id: download | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-*-${{github.run_id}} | |
path: /tmp | |
merge-multiple: true | |
- name: Download api-augment artifacts | |
id: download-js | |
uses: actions/download-artifact@v4 | |
with: | |
name: js-api-augment-${{github.run_id}}/js/api-augment/json | |
path: /tmp/polkadot-api-types-json | |
- name: List Downloaded Artifacts | |
working-directory: /tmp | |
run: | | |
ls -la | |
- name: Install subwasm | |
run: | | |
cargo install --locked --git https://github.com/chevdor/subwasm --tag v0.19.1 --force | |
subwasm --version | |
- name: Get Runtimes Info | |
id: get-runtimes-info | |
working-directory: /tmp | |
# Do NOT produce the dev version. That doesn't need to be part of the release notes, just in the artifacts | |
run: | | |
runtime_filename_paseo=${{needs.wait-for-all-builds.outputs.runtime_filename_paseo}} | |
runtime_info_paseo=$(subwasm info $runtime_filename_paseo | sed -Ez '$ s/\n+$//' | tr '\n' '|') | |
echo "runtime_info_paseo=$runtime_info_paseo" >> $GITHUB_OUTPUT | |
runtime_filename_mainnet=${{needs.wait-for-all-builds.outputs.runtime_filename_mainnet}} | |
runtime_info_mainnet=$(subwasm info $runtime_filename_mainnet | sed -Ez '$ s/\n+$//' | tr '\n' '|') | |
echo "runtime_info_mainnet=$runtime_info_mainnet" >> $GITHUB_OUTPUT | |
- name: Generate Release Notes | |
working-directory: tools/ci/release-notes | |
env: | |
CHANGELOG: ${{steps.sanitize-changelog.outputs.sanitized}} | |
RUNTIME_INFO_PASEO: ${{steps.get-runtimes-info.outputs.runtime_info_paseo}} | |
RUNTIME_INFO_MAINNET: ${{steps.get-runtimes-info.outputs.runtime_info_mainnet}} | |
IS_FULL_RELEASE: ${{steps.is-full-release.outputs.is-full-release}} | |
run: | | |
./build-release-notes.sh '${{steps.polkadot-version.outputs.version}}' \ | |
"${CHANGELOG}" \ | |
"${RUNTIME_INFO_MAINNET}" \ | |
"${RUNTIME_INFO_PASEO}" \ | |
"${IS_FULL_RELEASE}" \ | |
"/tmp/metadata-compare-mainnet.txt" \ | |
> release-notes.md | |
- name: Publish Release Candidate on GitHub | |
if: steps.is-full-release.outputs.is-full-release != 'true' | |
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 | |
with: | |
name: "[Release Candidate] ${{env.NEW_RELEASE_TAG}}" | |
prerelease: true | |
body_path: tools/ci/release-notes/release-notes.md | |
tag_name: ${{env.NEW_RELEASE_TAG}} | |
files: | | |
/tmp/frequency*.* | |
/tmp/metadata-compare-* | |
- name: Publish Full Release on GitHub | |
if: steps.is-full-release.outputs.is-full-release == 'true' | |
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 | |
with: | |
body_path: tools/ci/release-notes/release-notes.md | |
tag_name: ${{env.NEW_RELEASE_TAG}} | |
files: | | |
/tmp/frequency*.* | |
/tmp/metadata-compare-* | |
- name: Get Latest Commit | |
id: get-latest-commit | |
run: | | |
set -x | |
latest_commit_sha=$(git rev-parse HEAD) | |
echo "sha=$latest_commit_sha" >> $GITHUB_OUTPUT | |
- name: Update Git Latest Tag | |
if: | | |
steps.is-full-release.outputs.is-full-release == 'true' && | |
env.TEST_RUN != 'true' | |
uses: rickstaa/action-create-tag@88dbf7ff6fe2405f8e8f6c6fdfd78829bc631f83 | |
with: | |
commit_sha: ${{steps.get-latest-commit.outputs.sha}} | |
tag: ${{env.LATEST_FULL_RELEASE_TAG}} | |
force_push_tag: true | |
message: Latest full release | |
- name: Dispatch Auto-signer Workflow | |
if: env.TEST_RUN != 'true' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{secrets.GHA_WORKFLOW_TRIGGER}} | |
script: | | |
await github.rest.actions.createWorkflowDispatch({ | |
owner: 'frequency-chain', | |
repo: 'metadata-portal', | |
workflow_id: 'auto-sign.yml', | |
ref: 'main' | |
}) | |
release-node-images: | |
needs: wait-for-all-builds | |
name: Release ${{matrix.arch}} Node Docker Image for ${{matrix.network}} | |
strategy: | |
fail-fast: true | |
matrix: | |
arch: [amd64] | |
network: [testnet, mainnet] | |
include: | |
- network: testnet | |
build-profile: release | |
release-file-name-prefix: frequency-testnet | |
- network: mainnet | |
build-profile: release | |
release-file-name-prefix: frequency | |
- arch: amd64 | |
docker-platform: linux/amd64 | |
env: | |
DOCKER_HUB_PROFILE: frequencychain | |
IMAGE_NAME: parachain-node | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Set Env Vars | |
run: | | |
echo "BIN_DIR=target/${{matrix.build-profile}}" >> $GITHUB_ENV | |
echo "BUILT_BIN_FILENAME=frequency" >> $GITHUB_ENV | |
echo "RELEASE_BIN_FILENAME=${{matrix.release-file-name-prefix}}.${{matrix.arch}}" >> $GITHUB_ENV | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{env.RELEASE_BRANCH_NAME}} | |
- name: Full Release? | |
id: is-full-release | |
uses: ./.github/workflows/common/is-full-release | |
with: | |
version-tag: ${{env.NEW_RELEASE_TAG}} | |
- name: Download Binaries | |
id: download-binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-binary-${{matrix.network}}-${{github.run_id}} | |
path: . | |
- name: Extract and List Downloaded Binaries | |
run: | | |
download_dir=${{steps.download-binaries.outputs.download-path}} | |
mv "${download_dir}"/artifacts*/* "${download_dir}" | |
echo "Download dir: $download_dir" | |
echo "Downloaded binaries: $(ls -l $download_dir)" | |
- name: Move Binary to Target Dir | |
run: | | |
mkdir -p ${{env.BIN_DIR}} | |
mv ${{env.RELEASE_BIN_FILENAME}} ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} | |
chmod +x ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{matrix.arch}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{secrets.DOCKERHUB_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
- name: Build and Push Parachain Image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: ${{matrix.docker-platform}} | |
push: ${{env.TEST_RUN != 'true'}} | |
file: ./docker/${{env.IMAGE_NAME}}.dockerfile | |
tags: | | |
${{env.DOCKER_HUB_PROFILE}}/${{env.IMAGE_NAME}}-${{matrix.network}}:${{env.NEW_RELEASE_TAG}} | |
- name: Update DockerHub Latest Tag | |
if: steps.is-full-release.outputs.is-full-release == 'true' | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: ${{matrix.docker-platform}} | |
push: ${{env.TEST_RUN != 'true'}} | |
file: ./docker/${{env.IMAGE_NAME}}.dockerfile | |
tags: | | |
${{env.DOCKER_HUB_PROFILE}}/${{env.IMAGE_NAME}}-${{matrix.network}}:latest | |
- name: Update DockerHub Description | |
if: env.TEST_RUN != 'true' | |
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae | |
with: | |
username: ${{secrets.DOCKERHUB_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
repository: ${{env.DOCKER_HUB_PROFILE}}/${{env.IMAGE_NAME}}-${{matrix.network}} | |
readme-filepath: docker/${{env.IMAGE_NAME}}-${{matrix.network}}.overview.md | |
release-dev-images: | |
needs: wait-for-all-builds | |
name: Release Dev Docker Image for ${{matrix.node}} | |
strategy: | |
fail-fast: true | |
matrix: | |
arch: [amd64] | |
node: [collator-node-local, standalone-node] | |
include: | |
- node: collator-node-local | |
network: local | |
build-profile: release | |
release-file-name-prefix: frequency-local | |
- node: standalone-node | |
network: dev | |
build-profile: release | |
release-file-name-prefix: frequency-dev | |
env: | |
DOCKER_HUB_PROFILE: frequencychain | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Set Env Vars | |
run: | | |
echo "BIN_DIR=target/${{matrix.build-profile}}" >> $GITHUB_ENV | |
echo "BUILT_BIN_FILENAME=frequency" >> $GITHUB_ENV | |
echo "RELEASE_BIN_FILENAME=${{matrix.release-file-name-prefix}}.${{matrix.arch}}" >> $GITHUB_ENV | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{env.RELEASE_BRANCH_NAME}} | |
- name: Full Release? | |
id: is-full-release | |
uses: ./.github/workflows/common/is-full-release | |
with: | |
version-tag: ${{env.NEW_RELEASE_TAG}} | |
- name: Download Binaries | |
id: download-binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-binary-${{matrix.network}}-${{github.run_id}} | |
path: . | |
- name: Extract and List Downloaded Binaries | |
run: | | |
download_dir=${{steps.download-binaries.outputs.download-path}} | |
mv "${download_dir}"/artifacts*/* "${download_dir}" | |
echo "Download dir: $download_dir" | |
echo "Downloaded binaries: $(ls -l $download_dir)" | |
- name: Move Binary to Target Dir | |
run: | | |
mkdir -p ${{env.BIN_DIR}} | |
mv ${{env.RELEASE_BIN_FILENAME}} ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} | |
chmod +x ${{env.BIN_DIR}}/${{env.BUILT_BIN_FILENAME}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{matrix.arch}} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{secrets.DOCKERHUB_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
- name: Build and Push Dev Image | |
# if: env.TEST_RUN != 'true' | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: ${{matrix.docker-platform}} | |
push: ${{env.TEST_RUN != 'true'}} | |
file: ./docker/${{matrix.node}}.dockerfile | |
tags: | | |
${{env.DOCKER_HUB_PROFILE}}/${{matrix.node}}:${{env.NEW_RELEASE_TAG}} | |
- name: Update DockerHub Latest Tag | |
if: steps.is-full-release.outputs.is-full-release == 'true' | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: ${{matrix.docker-platform}} | |
push: ${{env.TEST_RUN != 'true'}} | |
file: ./docker/${{matrix.node}}.dockerfile | |
tags: | | |
${{env.DOCKER_HUB_PROFILE}}/${{matrix.node}}:latest | |
- name: Update DockerHub Description | |
if: env.TEST_RUN != 'true' | |
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae | |
with: | |
username: ${{secrets.DOCKERHUB_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
repository: ${{env.DOCKER_HUB_PROFILE}}/${{matrix.node}} | |
readme-filepath: docker/${{matrix.node}}.overview.md | |
# Published to https://frequency-chain.github.io/frequency/ | |
release-rust-developer-docs: | |
needs: wait-for-all-builds | |
name: Release Rust Developer Docs | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
if: env.TEST_RUN != 'true' | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
release-js-api-augment: | |
needs: wait-for-all-builds | |
name: Release JS API Augment | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{env.RELEASE_BRANCH_NAME}} | |
- name: Set up NodeJs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
registry-url: "https://registry.npmjs.org" | |
cache-dependency-path: js/api-augment/package-lock.json | |
- name: Download Dist Dir | |
id: download | |
uses: actions/download-artifact@v4 | |
with: | |
name: js-api-augment-${{github.run_id}} | |
path: js/api-augment/dist | |
- name: Version Package | |
if: env.TEST_RUN != 'true' | |
run: npm version --new-version "${{env.NEW_RELEASE_TAG}}" --no-git-tag-version | |
working-directory: js/api-augment/dist | |
- name: Release on NPM @latest | |
if: env.TEST_RUN != 'true' && | |
steps.is-full-release.outputs.is-full-release == 'true' | |
run: npm publish --tag latest --access public | |
working-directory: ./js/api-augment/dist | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} | |
- name: Release Candidate on NPM | |
if: env.TEST_RUN != 'true' && | |
steps.is-full-release.outputs.is-full-release != 'true' | |
run: npm publish --access public | |
working-directory: ./js/api-augment/dist | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} |