Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Release - Create draft #135

Release - Create draft

Release - Create draft #135

name: Release - Create draft
on:
workflow_dispatch:
inputs:
ref1:
description: The 'from' tag to use for the diff
default: parachains-v9.0.0
required: true
ref2:
description: The 'to' tag to use for the diff
default: release-parachains-v10.0.0
required: true
release_type:
description: Pass "client" for client releases, leave empty otherwise
required: false
pre_release:
description: For pre-releases
default: "true"
required: true
notification:
description: Whether or not to notify over Matrix
default: "true"
required: true
jobs:
get-rust-versions:
runs-on: ubuntu-latest
container:
image: paritytech/ci-linux:production
outputs:
rustc-stable: ${{ steps.get-rust-versions.outputs.stable }}
rustc-nightly: ${{ steps.get-rust-versions.outputs.nightly }}
steps:
- id: get-rust-versions
run: |
echo "stable=$(rustc +stable --version)" >> $GITHUB_OUTPUT
echo "nightly=$(rustc +nightly --version)" >> $GITHUB_OUTPUT
# We do not skip the entire job for client builds (although we don't need it)
# because it is a dep of the next job. However we skip the time consuming steps.
build-runtimes:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- category: assets
runtime: asset-hub-kusama
- category: assets
runtime: asset-hub-polkadot
- category: assets
runtime: asset-hub-westend
- category: bridge-hubs
runtime: bridge-hub-polkadot
- category: bridge-hubs
runtime: bridge-hub-kusama
- category: bridge-hubs
runtime: bridge-hub-rococo
- category: collectives
runtime: collectives-polkadot
- category: contracts
runtime: contracts-rococo
- category: starters
runtime: seedling
- category: starters
runtime: shell
- category: testing
runtime: rococo-parachain
steps:
- name: Checkout sources
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: ${{ github.event.inputs.ref2 }}
- name: Cache target dir
if: ${{ github.event.inputs.release_type != 'client' }}
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: "${{ github.workspace }}/runtime/${{ matrix.runtime }}/target"
key: srtool-target-${{ matrix.runtime }}-${{ github.sha }}
restore-keys: |
srtool-target-${{ matrix.runtime }}-
srtool-target-
- name: Build ${{ matrix.runtime }} runtime
if: ${{ github.event.inputs.release_type != 'client' }}
id: srtool_build
uses: chevdor/srtool-actions@v0.7.0
with:
image: paritytech/srtool
chain: ${{ matrix.runtime }}
runtime_dir: parachains/runtimes/${{ matrix.category }}/${{ matrix.runtime }}
- name: Store srtool digest to disk
if: ${{ github.event.inputs.release_type != 'client' }}
run: |
echo '${{ steps.srtool_build.outputs.json }}' | \
jq > ${{ matrix.runtime }}-srtool-digest.json
- name: Upload ${{ matrix.runtime }} srtool json
if: ${{ github.event.inputs.release_type != 'client' }}
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: ${{ matrix.runtime }}-srtool-json
path: ${{ matrix.runtime }}-srtool-digest.json
- name: Upload ${{ matrix.runtime }} runtime
if: ${{ github.event.inputs.release_type != 'client' }}
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: ${{ matrix.runtime }}-runtime
path: |
${{ steps.srtool_build.outputs.wasm_compressed }}
publish-draft-release:
runs-on: ubuntu-latest
needs: ["get-rust-versions", "build-runtimes"]
outputs:
release_url: ${{ steps.create-release.outputs.html_url }}
asset_upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Checkout sources
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0
path: cumulus
ref: ${{ github.event.inputs.ref2 }}
- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
with:
ruby-version: 3.0.0
- name: Download srtool json output
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- name: Prepare tooling
run: |
cd cumulus/scripts/ci/changelog
gem install bundler changelogerator:0.9.1
bundle install
changelogerator --help
URL=https://github.com/chevdor/tera-cli/releases/download/v0.2.1/tera-cli_linux_amd64.deb
wget $URL -O tera.deb
sudo dpkg -i tera.deb
tera --version
- name: Generate release notes
env:
RUSTC_STABLE: ${{ needs.get-rust-versions.outputs.rustc-stable }}
RUSTC_NIGHTLY: ${{ needs.get-rust-versions.outputs.rustc-nightly }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NO_CACHE: 1
DEBUG: 1
SHELL_DIGEST: ${{ github.workspace}}/shell-srtool-json/shell-srtool-digest.json
ASSET_HUB_WESTEND_DIGEST: ${{ github.workspace}}/asset-hub-westend-srtool-json/asset-hub-westend-srtool-digest.json
ASSET_HUB_KUSAMA_DIGEST: ${{ github.workspace}}/asset-hub-kusama-srtool-json/asset-hub-kusama-srtool-digest.json
ASSET_HUB_POLKADOT_DIGEST: ${{ github.workspace}}/asset-hub-polkadot-srtool-json/asset-hub-polkadot-srtool-digest.json
BRIDGE_HUB_ROCOCO_DIGEST: ${{ github.workspace}}/bridge-hub-rococo-srtool-json/bridge-hub-rococo-srtool-digest.json
BRIDGE_HUB_KUSAMA_DIGEST: ${{ github.workspace}}/bridge-hub-kusama-srtool-json/bridge-hub-kusama-srtool-digest.json
BRIDGE_HUB_POLKADOT_DIGEST: ${{ github.workspace}}/bridge-hub-polkadot-srtool-json/bridge-hub-polkadot-srtool-digest.json
COLLECTIVES_POLKADOT_DIGEST: ${{ github.workspace}}/collectives-polkadot-srtool-json/collectives-polkadot-srtool-digest.json
ROCOCO_PARA_DIGEST: ${{ github.workspace}}/rococo-parachain-srtool-json/rococo-parachain-srtool-digest.json
CANVAS_KUSAMA_DIGEST: ${{ github.workspace}}/contracts-rococo-srtool-json/contracts-rococo-srtool-digest.json
REF1: ${{ github.event.inputs.ref1 }}
REF2: ${{ github.event.inputs.ref2 }}
PRE_RELEASE: ${{ github.event.inputs.pre_release }}
RELEASE_TYPE: ${{ github.event.inputs.release_type }}
run: |
find ${{env.GITHUB_WORKSPACE}} -type f -name "*-srtool-digest.json"
if [ "$RELEASE_TYPE" != "client" ]; then
ls -al $SHELL_DIGEST || true
ls -al $ASSET_HUB_WESTEND_DIGEST || true
ls -al $ASSET_HUB_KUSAMA_DIGEST || true
ls -al $ASSET_HUB_POLKADOT_DIGEST || true
ls -al $BRIDGE_HUB_ROCOCO_DIGEST || true
ls -al $BRIDGE_HUB_KUSAMA_DIGEST || true
ls -al $BRIDGE_HUB_POLKADOT_DIGEST || true
ls -al $COLLECTIVES_POLKADOT_DIGEST || true
ls -al $ROCOCO_PARA_DIGEST || true
ls -al $CANVAS_KUSAMA_DIGEST || true
fi
echo "The diff will be computed from $REF1 to $REF2"
cd cumulus/scripts/ci/changelog
./bin/changelog $REF1 $REF2 release-notes.md
ls -al {release-notes.md,context.json} || true
- name: Archive srtool json
if: ${{ github.event.inputs.release_type != 'client' }}
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: srtool-json
path: |
**/*-srtool-digest.json
- name: Archive context artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: release-notes-context
path: |
cumulus/scripts/ci/changelog/context.json
- name: Create draft release
id: create-release
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: ./cumulus/scripts/ci/changelog/release-notes.md
tag_name: ${{ github.event.inputs.ref2 }}
release_name: ${{ github.event.inputs.ref2 }}
draft: true
publish-runtimes:
if: ${{ github.event.inputs.release_type != 'client' }}
runs-on: ubuntu-latest
needs: ["publish-draft-release"]
env:
RUNTIME_DIR: parachains/runtimes
strategy:
matrix:
include:
- category: assets
runtime: asset-hub-kusama
- category: assets
runtime: asset-hub-polkadot
- category: assets
runtime: asset-hub-westend
- category: bridge-hubs
runtime: bridge-hub-polkadot
- category: bridge-hubs
runtime: bridge-hub-kusama
- category: bridge-hubs
runtime: bridge-hub-rococo
- category: collectives
runtime: collectives-polkadot
- category: contracts
runtime: contracts-rococo
- category: starters
runtime: seedling
- category: starters
runtime: shell
- category: testing
runtime: rococo-parachain
steps:
- name: Checkout sources
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: ${{ github.event.inputs.ref2 }}
- name: Download artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
- uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
with:
ruby-version: 3.0.0
- name: Get runtime version for ${{ matrix.runtime }}
id: get-runtime-ver
run: |
echo "require './scripts/ci/github/runtime-version.rb'" > script.rb
echo "puts get_runtime(runtime: \"${{ matrix.runtime }}\", runtime_dir: \"$RUNTIME_DIR/${{ matrix.category }}\")" >> script.rb
echo "Current folder: $PWD"
ls "$RUNTIME_DIR/${{ matrix.category }}/${{ matrix.runtime }}"
runtime_ver=$(ruby script.rb)
echo "Found version: >$runtime_ver<"
echo "runtime_ver=$runtime_ver" >> $GITHUB_OUTPUT
- name: Fix runtime name
id: fix-runtime-path
run: |
cd "${{ matrix.runtime }}-runtime/"
mv "$(sed -E 's/- */_/g' <<< ${{ matrix.runtime }})_runtime.compact.compressed.wasm" "${{ matrix.runtime }}_runtime.compact.compressed.wasm" || true
- name: Upload compressed ${{ matrix.runtime }} wasm
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.publish-draft-release.outputs.asset_upload_url }}
asset_path: "${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.compressed.wasm"
asset_name: ${{ matrix.runtime }}_runtime-v${{ steps.get-runtime-ver.outputs.runtime_ver }}.compact.compressed.wasm
asset_content_type: application/wasm
post_to_matrix:
if: ${{ github.event.inputs.notification == 'true' }}
runs-on: ubuntu-latest
needs: publish-draft-release
strategy:
matrix:
channel:
- name: 'Cumulus Release Coordination'
room: '!ZrLPsivsytpkdJfVaa:matrix.parity.io'
pre-releases: true
steps:
- name: Matrix notification to ${{ matrix.channel.name }}
uses: s3krit/matrix-message-action@70ad3fb812ee0e45ff8999d6af11cafad11a6ecf # v0.0.3
with:
room_id: ${{ matrix.channel.room }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: |
**New draft for ${{ github.repository }}**: ${{ github.event.inputs.ref2 }}<br/>
Draft release created: [draft](${{ needs.publish-draft-release.outputs.release_url }})
NOTE: The link above will no longer be valid if the draft is edited. You can then use the following link:
[${{ github.server_url }}/${{ github.repository }}/releases](${{ github.server_url }}/${{ github.repository }}/releases)
server: "matrix.parity.io"