difftreelog
push ready polkadot-types workflow
in: master
3 files changed
.github/workflows/polkadot-types.ymldiffbeforeafterboth--- a/.github/workflows/polkadot-types.yml
+++ b/.github/workflows/polkadot-types.yml
@@ -3,15 +3,15 @@
name: Polkadot types
# Triger: only call from main workflow(re-usable workflows)
+on:
+ workflow_call:
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
# on:
-# workflow_call:
-# # Allows you to run this workflow manually from the Actions tab
-# workflow_dispatch:
-
-on:
- pull_request:
- branches: [ 'develop' ]
- types: [ opened, reopened, synchronize, ready_for_review, converted_to_draft ]
+# pull_request:
+# branches: [ 'develop' ]
+# types: [ opened, reopened, synchronize, ready_for_review, converted_to_draft ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
@@ -29,12 +29,12 @@
strategy:
matrix:
include:
- # - network: sapphire
- # usage: "--sapphire"
- # - network: "opal"
- # usage: ""
- # - network: "quartz"
- # usage: ""
+ - network: sapphire
+ usage: "--sapphire"
+ - network: "opal"
+ usage: ""
+ - network: "quartz"
+ usage: ""
- network: "unique"
usage: ""
.github/workflows/schedule-trigger-for-develop-build.ymldiffbeforeafterboth--- a/.github/workflows/schedule-trigger-for-develop-build.yml
+++ b/.github/workflows/schedule-trigger-for-develop-build.yml
@@ -1,8 +1,8 @@
name: schedule-trigger-for-develop-build
on:
# update the branch ci/develop-scheduler every night
- schedule:
- - cron: '0 1 * * *'
+ # schedule:
+ # - cron: '0 1 * * *'
# or update the branch manually
workflow_dispatch:
# pull_request:
tests/scripts/generate_types_package.shdiffbeforeafterboth1#!/usr/bin/env bash23set -eu45DIR=realpathdirname"$0"6TEMPLATE=$DIR/types_template7GIT_REPO=git@github.com:UniqueNetwork/unique-types-js.git89. $DIR/functions.sh1011usage() {12 echo "Usage: [RPC_URL=http://localhost:9933] $0 <--rc|--release|--sapphire> [--force] [--push] [--rpc-url=http://localhost:9933]" 1>&213 exit 114}1516rc=17sapphire=18release=19force=20push=2122for i in "$@"; do23case $i in24 --rc)25 rc=126 if test "$release" -o "$sapphire"; then usage; fi27 ;;28 --sapphire)29 sapphire=130 if test "$rc" -o "$release"; then usage; fi31 ;;32 --release)33 release=134 if test "$rc" -o "$sapphire"; then usage; fi35 ;;36 --force)37 force=138 ;;39 --push)40 push=141 ;;42 --rpc-url=*)43 RPC_URL=i44 ;;45 *)46 usage47 ;;48esac49done5051if test \( ! \( "$rc" -o "$release" -o "$sapphire" \) \) -o \( "RPC_URL" = "" \); then52 usage53elif test "$rc"; then54 echo "Rc build"55else56 echo "Release build"57fi5859cd $DIR/..60yarn polkadot-types6162version=do_rpc""63spec_version=echo$version|jq-r64spec_name=echo$version|jq-r65echo "Spec version: $spec_version, name: $spec_name"6667case $spec_name in68 opal)69 package_name=@unique-nft/opal-testnet-types70 repo_branch=opal-testnet71 repo_tag=$repo_branch72 ;;73 quartz)74 package_name=@unique-nft/quartz-mainnet-types75 repo_branch=quartz-mainnet76 repo_tag=$repo_branch77 ;;78 unique)79 package_name=@unique-nft/unique-mainnet-types80 repo_branch=master81 repo_tag=unique-mainnet82 ;;83 *)84 echo "unknown spec name: $spec_name"85 exit 186 ;;87esac8889if test "$rc" = 1; then90 if "$spec_name" != opal; then91 echo "rc types can only be based on opal spec"92 exit 193 fi94 package_name=@unique-nft/rc-types95 repo_branch=rc96 repo_tag=$repo_branch97fi98if test "$sapphire" = 1; then99 if "$spec_name" != opal; then100 echo "sapphire types can only be based on opal spec"101 exit 1102 fi103 package_name=@unique-nft/sapphire-mainnet-types104 repo_branch=sapphire-mainnet105 repo_tag=$repo_branch106fi107108package_version=spec_version.echospec_version|sed's/^0*//'.109last_patch=NEVER110for tag in git-t--refs$GIT_REPO|cut-f|sort-r; do111 tag_prefix=refs/tags/$repo_tag-v$package_version112 if [[ $tag == $tag_prefix* ]]; then113 last_patch=tag114 break;115 fi116done117echo "Package version: package_versionX, name: $package_name"118echo "Last published: $package_version$last_patch"119120if test "$last_patch" = "NEVER"; then121 new_package_version=package_version0122else123 new_package_version=package_version$((last_patch+1))124fi125package_version=package_version$last_patch126echo "New package version: $new_package_version"127128pjsapi_ver=^cat$DIR|jq-r'.dependencies."@polkadot/api"'|sed-e"s/^\^//"129tsnode_ver=^cat$DIR|jq-r'.devDependencies."ts-node"'|sed-e"s/^\^//"130ts_ver=^cat$DIR|jq-r'.devDependencies."typescript"'|sed-e"s/^\^//"131132gen=mktemp-d133pushd $gen134git clone $GIT_REPO -b $repo_branch --depth 1 .135if test "$last_patch" != "NEVER"; then136 git reset --hard $repo_tag-v$package_version137fi138git rm -r "*"139popd140141# Using old package_version here, becaue we first check if142# there is any difference between generated and already uplaoded types143cat $TEMPLATE/package.json \144| jq '.private = false' - \145| jq '.name = "'$package_name'"' - \146| jq '.version = "'$package_version'"' - \147| jq '.peerDependencies."@polkadot/api" = "'$pjsapi_ver'"' - \148| jq '.peerDependencies."@polkadot/types" = "'$pjsapi_ver'"' - \149| jq '.devDependencies."@polkadot/api" = "'$pjsapi_ver'"' - \150| jq '.devDependencies."@polkadot/types" = "'$pjsapi_ver'"' - \151| jq '.devDependencies."ts-node" = "'$tsnode_ver'"' - \152| jq '.devDependencies."typescript" = "'$ts_ver'"' - \153> $gen/package.json154for file in .gitignore .npmignore README.md tsconfig.json; do155 cp $TEMPLATE/$file $gen/156done157package_name_replacement=printf'%s\n'"$package_name"|sed-e's/[\/&]/\\&/g'158sed -i 's/PKGNAME/'$package_name_replacement'/' $gen/README.md159160rsync -ar --exclude .gitignore src/interfaces/ $gen161for file in $gen/augment-* $gen/**/types.ts $gen/registry.ts; do162 sed -i '1s;^;//@ts-nocheck\n;' $file163done164165pushd $gen166git add .167popd168169pushd $gen170if git diff --quiet HEAD && test ! "$force"; then171 echo "no changes detected"172 exit 0173fi174popd175176mv $gen/package.json $gen/package.old.json177cat $gen/package.old.json \178| jq '.version = "'$new_package_version'"' - \179> $gen/package.json180rm $gen/package.old.json181pushd $gen182git add package.json183popd184185echo "package.json contents:"186cat $gen/package.json187echo "overall diff:"188pushd $gen189git status190git diff HEAD || true191popd192193# This check is only active if running in interactive terminal194if [ -t 0 ]; then195 read -p "Is everything ok at $gen [y/n]? " -n 1 -r196 echo197 if [[ ! $REPLY =~ ^[Yy]$ ]]; then198 echo "Aborting!"199 exit 1200 fi201fi202203pushd $gen204yarn205yarn prepublish206git commit -m "chore: upgrade types to v$new_package_version"207git tag --force $repo_tag-v$new_package_version208if test "$push" = 1; then209 git push --tags --force -u origin HEAD210else211 echo "--push not given, origin repo left intact"212 echo "To publish manually, go to $gen, and run \"git push --tags --force -u origin HEAD\""213fi214popd