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# git config user.name "Unique"10# git config user.email "github-actions@usetech.com"1112. $DIR/functions.sh1314usage() {15 echo "Usage: [RPC_URL=http://localhost:9933] $0 <--rc|--release|--sapphire> [--force] [--push] [--rpc-url=http://localhost:9933]" 1>&216 exit 117}1819rc=20sapphire=21release=22force=23push=2425for i in "$@"; do26case $i in27 --rc)28 rc=129 if test "$release" -o "$sapphire"; then usage; fi30 ;;31 --sapphire)32 sapphire=133 if test "$rc" -o "$release"; then usage; fi34 ;;35 --release)36 release=137 if test "$rc" -o "$sapphire"; then usage; fi38 ;;39 --force)40 force=141 ;;42 --push)43 push=144 ;;45 --rpc-url=*)46 RPC_URL=i47 ;;48 *)49 usage50 ;;51esac52done5354if test \( ! \( "$rc" -o "$release" -o "$sapphire" \) \) -o \( "RPC_URL" = "" \); then55 usage56elif test "$rc"; then57 echo "Rc build"58else59 echo "Release build"60fi6162cd $DIR/..63yarn polkadot-types6465version=do_rpc""66spec_version=echo$version|jq-r67spec_name=echo$version|jq-r68echo "Spec version: $spec_version, name: $spec_name"6970case $spec_name in71 opal)72 package_name=@unique-nft/opal-testnet-types73 repo_branch=opal-testnet74 repo_tag=$repo_branch75 ;;76 quartz)77 package_name=@unique-nft/quartz-mainnet-types78 repo_branch=quartz-mainnet79 repo_tag=$repo_branch80 ;;81 unique)82 package_name=@unique-nft/unique-mainnet-types83 repo_branch=master84 repo_tag=unique-mainnet85 ;;86 *)87 echo "unknown spec name: $spec_name"88 exit 189 ;;90esac9192if test "$rc" = 1; then93 if "$spec_name" != opal; then94 echo "rc types can only be based on opal spec"95 exit 196 fi97 package_name=@unique-nft/rc-types98 repo_branch=rc99 repo_tag=$repo_branch100fi101if test "$sapphire" = 1; then102 if "$spec_name" != opal; then103 echo "sapphire types can only be based on opal spec"104 exit 1105 fi106 package_name=@unique-nft/sapphire-mainnet-types107 repo_branch=sapphire-mainnet108 repo_tag=$repo_branch109fi110111package_version=spec_version.echospec_version|sed's/^0*//'.112last_patch=NEVER113for tag in git-t--refs$GIT_REPO|cut-f|sort-r; do114 tag_prefix=refs/tags/$repo_tag-v$package_version115 if [[ $tag == $tag_prefix* ]]; then116 last_patch=tag117 break;118 fi119done120echo "Package version: package_versionX, name: $package_name"121echo "Last published: $package_version$last_patch"122123if test "$last_patch" = "NEVER"; then124 new_package_version=package_version0125else126 new_package_version=package_version$((last_patch+1))127fi128package_version=package_version$last_patch129echo "New package version: $new_package_version"130131pjsapi_ver=^cat$DIR|jq-r'.dependencies."@polkadot/api"'|sed-e"s/^\^//"132tsnode_ver=^cat$DIR|jq-r'.devDependencies."ts-node"'|sed-e"s/^\^//"133ts_ver=^cat$DIR|jq-r'.devDependencies."typescript"'|sed-e"s/^\^//"134135gen=mktemp-d136pushd $gen137git clone $GIT_REPO -b $repo_branch --depth 1 .138if test "$last_patch" != "NEVER"; then139 git reset --hard $repo_tag-v$package_version140fi141git rm -r "*"142popd143144# Using old package_version here, becaue we first check if145# there is any difference between generated and already uplaoded types146cat $TEMPLATE/package.json \147| jq '.private = false' - \148| jq '.name = "'$package_name'"' - \149| jq '.version = "'$package_version'"' - \150| jq '.peerDependencies."@polkadot/api" = "'$pjsapi_ver'"' - \151| jq '.peerDependencies."@polkadot/types" = "'$pjsapi_ver'"' - \152| jq '.devDependencies."@polkadot/api" = "'$pjsapi_ver'"' - \153| jq '.devDependencies."@polkadot/types" = "'$pjsapi_ver'"' - \154| jq '.devDependencies."ts-node" = "'$tsnode_ver'"' - \155| jq '.devDependencies."typescript" = "'$ts_ver'"' - \156> $gen/package.json157for file in .gitignore .npmignore README.md tsconfig.json; do158 cp $TEMPLATE/$file $gen/159done160package_name_replacement=printf'%s\n'"$package_name"|sed-e's/[\/&]/\\&/g'161sed -i 's/PKGNAME/'$package_name_replacement'/' $gen/README.md162163rsync -ar --exclude .gitignore src/interfaces/ $gen164for file in $gen/augment-* $gen/**/types.ts $gen/registry.ts; do165 sed -i '1s;^;//@ts-nocheck\n;' $file166done167168pushd $gen169git add .170popd171172pushd $gen173if git diff --quiet HEAD && test ! "$force"; then174 echo "no changes detected"175 exit 0176fi177popd178179mv $gen/package.json $gen/package.old.json180cat $gen/package.old.json \181| jq '.version = "'$new_package_version'"' - \182> $gen/package.json183rm $gen/package.old.json184pushd $gen185git add package.json186popd187188echo "package.json contents:"189cat $gen/package.json190echo "overall diff:"191pushd $gen192git status193git diff HEAD || true194popd195196# This check is only active if running in interactive terminal197if [ -t 0 ]; then198 read -p "Is everything ok at $gen [y/n]? " -n 1 -r199 echo200 if [[ ! $REPLY =~ ^[Yy]$ ]]; then201 echo "Aborting!"202 exit 1203 fi204fi205206pushd $gen207yarn208yarn prepublish209git commit -m "chore: upgrade types to v$new_package_version"210git tag --force $repo_tag-v$new_package_version211if test "$push" = 1; then212 git push --tags --force -u origin HEAD213else214 echo "--push not given, origin repo left intact"215 echo "To publish manually, go to $gen, and run \"git push --tags --force -u origin HEAD\""216fi217popd1#!/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