Skip to content

Commit

Permalink
chore(release): be able to make multi package release
Browse files Browse the repository at this point in the history
  • Loading branch information
zfy0701 committed Dec 31, 2022
1 parent 55bd4e4 commit 033d015
Show file tree
Hide file tree
Showing 17 changed files with 486 additions and 452 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: Publish Package
name: Publish CLI

on:
push:
branches:
- main
- release
paths:
- 'packages/cli/**'

jobs:
release:
runs-on: ubuntu-latest
Expand All @@ -22,22 +25,21 @@ jobs:
- name: Install
run: yarn install
- name: Build
run: yarn lerna run --scope=@sentio/sdk build
run: yarn lerna run build
- name: Clean templates node mdules
run: "rm -rf */node_modules"
working-directory: cli/templates
working-directory: packages/cli/templates
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v3
with:
working_directory: packages/sdk
working_directory: packages/cli
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: mark prerelease and summary
if: steps.semantic.outputs.new_release_published == 'true'
run: |
# gh release edit v${{ steps.semantic.outputs.new_release_version }} --prerelease
echo "### New version v${{ steps.semantic.outputs.new_release_version }} cut" >> $GITHUB_STEP_SUMMARY
echo "commit: ${GITHUB_SHA}, branch/tag: ${GITHUB_REF}" >> $GITHUB_STEP_SUMMARY
echo "automatic release will be marked as prerelease, please manually confirm in the release page" >> $GITHUB_STEP_SUMMARY
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/publish-sdk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish SDK

on:
push:
branches:
- main
- release
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ github.event.inputs.commit }}
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: 16
- name: Install
run: yarn install
- name: Build
run: yarn lerna run --scope=@sentio/sdk build
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v3
# with:
# working_directory: packages/sdk
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Make Release Summary
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo "### New version v${{ steps.semantic.outputs.new_release_version }} cut" >> $GITHUB_STEP_SUMMARY
echo "commit: ${GITHUB_SHA}, branch/tag: ${GITHUB_REF}" >> $GITHUB_STEP_SUMMARY
echo "automatic release will be marked as prerelease, please manually confirm in the release page" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.semantic.outputs.new_release_notes }}" >> $GITHUB_STEP_SUMMARY
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
- name: report error
if: steps.semantic.outputs.new_release_published == 'false'
run: |
echo "### No version cut" >> $GITHUB_STEP_SUMMARY
echo "Check Semantic Release output for details"
exit(1)
- name: Lerna Publish
run: |
DIST_TAG=latest
if [[ "${{ contains(steps.semantic.outputs.new_release_version, '-rc.') }}" == "true" ]]; then
DIST_TAG=rc
fi
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
yarn lerna publish ${{ steps.semantic.outputs.new_release_version }} --no-private --yes --no-push --no-git-tag-version --dist-tag $DIST_TAG
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
outputs:
release_version: ${{ steps.release.outputs.release_version }}
1 change: 1 addition & 0 deletions examples/aptos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@sentio/example-aptos",
"license": "Apache-2.0",
"version": "1.0.0",
"private": "true",
"scripts": {
"compile": "tsc -p .",
"test": "jest",
Expand Down
1 change: 1 addition & 0 deletions examples/aurory/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@sentio/example-aurory",
"version": "1.0.0",
"private": "true",
"scripts": {
"test": "jest",
"gen": "sentio gen",
Expand Down
1 change: 1 addition & 0 deletions examples/sui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@sentio/example-sui",
"license": "Apache-2.0",
"version": "1.0.0",
"private": "true",
"scripts": {
"compile": "tsc -p .",
"test": "jest",
Expand Down
1 change: 1 addition & 0 deletions examples/wormhole/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@sentio/example-wormhole",
"license": "Apache-2.0",
"version": "1.0.0",
"private": "true",
"scripts": {
"compile": "tsc -p .",
"test": "jest",
Expand Down
1 change: 1 addition & 0 deletions examples/x2y2-complex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@sentio/example-x2y2-complex",
"license": "Apache-2.0",
"version": "1.0.0",
"private": "true",
"scripts": {
"compile": "tsc -p .",
"test": "jest",
Expand Down
1 change: 1 addition & 0 deletions examples/x2y2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@sentio/example-x2y2",
"license": "Apache-2.0",
"version": "1.0.0",
"private": "true",
"scripts": {
"compile": "tsc -p .",
"test": "jest",
Expand Down
6 changes: 3 additions & 3 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"packages_no_need": ["sdk", "cli", "cli/templates", "examples/*"],
"version__": "independent",
"version": "1.0.0-development",
"version": "1.0.0-rc.5",
"npmClient": "yarn",
"useWorkspaces": true,
"stream": true,
"concurrency": 1
"concurrency": 1,
"command": {}
}
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,29 @@
"devDependencies": {
"@ls-lint/ls-lint": "^1.11.2",
"@nrwl/nx-cloud": "^15.0.2",
"@types/jest": "^29.0.0",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"@types/chai": "^4.3.1",
"@types/expect": "^24.3.0",
"@types/jest": "^29.0.0",
"@types/node": "^18.0.4",
"@typescript-eslint/eslint-plugin": "^5.38.0",
"@typescript-eslint/parser": "^5.38.0",
"chai": "^4.3.6",
"clean-publish": "^4.0.1",
"conventional-changelog-conventionalcommits": "^5.0.0",
"eslint": "^8.27.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.26.0",
"eslint-config-prettier": "^8.5.0",
"jest": "^29.0.3",
"lerna": "^6.3.0",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"prettier-plugin-sh": "^0.12.8",
"semantic-release": "^19.0.5",
"semantic-release-monorepo": "^7.0.5",
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^4.8.0",
"clean-publish": "^4.0.1",
"semantic-release": "^19.0.5",
"conventional-changelog-conventionalcommits": "^5.0.0"
"typescript": "^4.8.0"
},
"scripts": {
"format": "prettier --write .",
Expand Down
7 changes: 3 additions & 4 deletions packages/base/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"name": "@sentio/base",
"license": "Apache-2.0",
"version": "1.0.0-development",
"version": "1.0.0-rc.5",
"scripts": {
"compile": "tsc -p .",
"build": "yarn compile",
"test": "jest"
},
"dependencies": {},
"devDependencies": {},
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"module": "./lib/index.js",
Expand All @@ -19,5 +17,6 @@
],
"engines": {
"node": ">=16"
}
},
"gitHead": "8bec43cdc9e778d66a4154bc1be1f9276b680408"
}
3 changes: 2 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "@sentio/cli",
"license": "Apache-2.0",
"version": "1.0.5",
"private": true,
"version": "1.1.0",
"scripts": {
"compile": "tsc -p . && cp src/webpack.config.js lib/",
"build": "yarn compile",
Expand Down
38 changes: 38 additions & 0 deletions packages/cli/release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = {
extends: ["semantic-release-monorepo"],
branches: ['release', { name: 'main', prerelease: 'rc' }],
plugins: [
[
'@semantic-release/commit-analyzer',
{
preset: 'angular',
releaseRules: [
{ type: 'release', "scope": 'major', release: 'major' },
{ type: 'release', "scope": 'minor', release: 'minor' },
{ type: 'release', "scope": 'patch', release: 'patch' },
{ type: 'chore', release: 'patch' },
{ type: 'refactor', release: 'patch' },
],
},
],
["@semantic-release/npm", {
}],
['@semantic-release/release-notes-generator', {
preset: 'conventionalcommits',
presetConfig: {
types: [
{ type: 'feat', section: 'Features' },
{ type: 'fix', section: 'Bug Fixes' },
{ type: 'chore', section: 'Internal', hidden: false },
{ type: 'refactor', section: 'Internal', hidden: false },
]},
}],
[
'@semantic-release/github',
{
successComment: false,
labels: false,
},
],
],
}
5 changes: 3 additions & 2 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sentio/runtime",
"license": "Apache-2.0",
"version": "1.0.0-development",
"version": "1.0.0-rc.5",
"scripts": {
"compile": "tsc -p .",
"build": "yarn compile",
Expand Down Expand Up @@ -48,5 +48,6 @@
],
"engines": {
"node": ">=16"
}
},
"gitHead": "8bec43cdc9e778d66a4154bc1be1f9276b680408"
}
10 changes: 5 additions & 5 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sentio/sdk",
"license": "Apache-2.0",
"version": "1.0.0-development",
"version": "1.0.0-rc.5",
"scripts": {
"compile_target": "yarn tsc -b src/target-ethers-sentio/tsconfig.json",
"compile": "tsc -p . && cp src/utils/*.csv lib/utils",
Expand All @@ -17,17 +17,16 @@
"gen_test_abi": "ts-node src/test-abi-code-gen.ts src/tests/abis src/tests/types",
"gen_bultin_evm": "typechain --target lib/target-ethers-sentio --out-dir src/builtin/internal 'src/abis/*.json'",
"gen_bultin_others": "ts-node src/test-abi-code-gen.ts src/abis src/builtin",
"postbuild": "echo || clear-package-json package.json -o ./lib/package.json && cp release.config.js ./lib",
"docs": "typedoc --options typedoc.json"
},
"dependencies": {
"@sentio/cli": "^1.0.0",
"@types/bs58": "^4.0.1",
"@ethersproject/providers": "~5.7.0",
"@project-serum/anchor": "^0.26.0",
"@sentio/cli": "^1.0.0",
"@solana/web3.js": "^1.47.3",
"@typechain/ethers-v5": "^10.0.0",
"@types/bn.js": "^5.1.0",
"@types/bs58": "^4.0.1",
"aptos-sdk": "npm:aptos@^1.3.17",
"bignumber.js": "^9.1.0",
"bn.js": "^5.2.1",
Expand Down Expand Up @@ -73,5 +72,6 @@
],
"engines": {
"node": ">=16"
}
},
"gitHead": "8bec43cdc9e778d66a4154bc1be1f9276b680408"
}
5 changes: 3 additions & 2 deletions packages/sdk/release.config.js → release.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
// extends: "semantic-release-monorepo",
branches: ['release', { name: 'main', prerelease: 'rc' }],
plugins: [
[
Expand All @@ -14,9 +15,9 @@ module.exports = {
],
},
],
["@semantic-release/npm", {
// ["@semantic-release/npm", {
// "pkgRoot": "dist"
}],
// }],
['@semantic-release/release-notes-generator', {
preset: 'conventionalcommits',
presetConfig: {
Expand Down
Loading

0 comments on commit 033d015

Please sign in to comment.