Skip to content

Commit

Permalink
feat: automate version bumping and type release process
Browse files Browse the repository at this point in the history
  • Loading branch information
AtelyPham committed Sep 24, 2024
1 parent 6d861d0 commit 9dc3649
Show file tree
Hide file tree
Showing 5 changed files with 1,720 additions and 206 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/publish-types.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Publish Types

# If changes are made to the types package.json,
# If changes are made to the types/src/** files
# Issue a new release to npm for the types package.
on:
push:
branches:
- main
paths:
- "types/package.json"
- 'types/src/**'

jobs:
build:
Expand All @@ -21,16 +21,14 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- name: Install npm dependencies
run: cd types && yarn install
- name: Configure Github Actions user
run: |
git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
- name: Run a build
run: cd types && yarn build
- name: Publish the package
run: cd types && yarn publish-types
env:
Expand Down
18 changes: 18 additions & 0 deletions types/.release-it.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Config } from 'release-it'

export default {
hooks: {
'after:bump': 'yarn run build',
},
git: {
commitMessage: 'Release `tangle-substrate-types` v${version}',
tag: false,
push: false,
},
github: {
release: false,
},
npm: {
publish: true,
},
} satisfies Config
9 changes: 2 additions & 7 deletions types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,19 @@
"build:interfaces:defs": "tsx node_modules/.bin/polkadot-types-from-defs --input ./src/interfaces --package @webb-tools/tangle-substrate-types --endpoint ws://127.0.0.1:9944",
"build:interfaces:chain": "tsx node_modules/.bin/polkadot-types-from-chain --output ./src/interfaces --package @webb-tools/tangle-substrate-types --endpoint ws://127.0.0.1:9944",
"clean": "rm -rf build",
"publish-types": "node ./scripts/publish-types.js"
"publish-types": "release-it --ci patch"
},
"dependencies": {
"@polkadot/api": "^13.2.1",
"@polkadot/typegen": "^13.2.1",
"@polkadot/types": "^13.2.1",
"ecpair": "^2.1.0",
"fs-extra": "^11.2.0",
"glob2base": "^0.0.12",
"minimatch": "^9.0.3",
"mkdirp": "^3.0.1",
"tiny-secp256k1": "^2.2.3"
},
"devDependencies": {
"bunchee": "^5.4.0",
"prettier": "3.2.5",
"rimraf": "5.0.5",
"tsconfig-paths": "^4.2.0",
"release-it": "^17.6.0",
"tsx": "^4.19.1",
"typescript": "5.4.2"
},
Expand Down
95 changes: 0 additions & 95 deletions types/scripts/publish-types.js

This file was deleted.

Loading

0 comments on commit 9dc3649

Please sign in to comment.