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\""216fi217popd