Skip to content

Commit

Permalink
Merge pull request #321 from VenusProtocol/add-semantic-release-to-main
Browse files Browse the repository at this point in the history
Add semantic release to main
  • Loading branch information
coreyar authored Aug 23, 2023
2 parents 989dcb1 + 7f28dc0 commit e8ce7c7
Show file tree
Hide file tree
Showing 7 changed files with 3,196 additions and 85 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

on:
push:
branches:
- main
- develop

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-node@v2
with:
cache: "yarn"

- name: Install dependencies
# Hack to get around failing "ethereumjs-abi The remote archive doesn't match the expected checksum" error
run: YARN_CHECKSUM_BEHAVIOR=update yarn

- name: Compile types
run: yarn hardhat typechain

- name: Build
run: yarn build

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.VENUS_TOOLS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_AUTHOR_NAME: Venus Tools
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: Venus Tools
GIT_COMMITTER_EMAIL: [email protected]
run: yarn semantic-release
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ name: Venus-Protocol

on:
push:
branches: [master, develop]
branches: [main, develop]
pull_request:
branches: [master, develop]
branches: [main, develop]

jobs:
test:
Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1} --config ./commitlint.config.js
88 changes: 88 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{"breaking": true, "release": "major"},
{
"type": "build",
"release": false
},
{
"type": "chore",
"release": false
},
{
"type": "docs",
"release": "patch"
},
{
"type": "ci",
"release": false
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "refactor",
"release": "patch"
},
{
"type": "test",
"release": false
}
],
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES"
]
}
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/npm",
{
"npmPublish": true
}
],
[
"@semantic-release/git",
{
"assets": [
"package.json",
"CHANGELOG.md"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
],
"branches": [
{
"name": "main"
},
{
"name": "develop",
"prerelease": "dev"
}
]
}
5 changes: 5 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
ignores: [commit => commit.includes("[skip ci]"), commit => commit.includes("Merge pull request")],
"type-enum": [2, "always", ["build", "chore", "ci", "docs", "feat", "fix", "refactor", "test"]],
};
38 changes: 25 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@
"name": "@venusprotocol/venus-protocol",
"version": "0.7.0",
"description": "The Venus Money Market",
"repository": "[email protected]:VenusProtocol/venus-protocol.git",
"author": "Venus",
"license": "BSD-3-Clause",
"files": [
"artifacts",
"networks",
"deploy",
"contracts"
"dist",
"contracts",
"deployments"
],
"scripts": {
"compile": "hardhat compile",
"test": "hardhat test",
"build": "rm -rf dist && tsc --declaration && hardhat compile && cp -r ./{package.json,yarn.lock,artifacts,contracts,networks} dist/",
"publish:dist": "yarn build && cd dist && yarn publish --access public",
"build": "rm -rf dist && tsc --declaration && hardhat compile",
"lint": "yarn lint:ts && yarn lint:sol && yarn prettier:check",
"lint:ts": "eslint --config ./.eslintrc.yaml --ignore-path ./.eslintignore --ext .js,.ts .",
"lint:ts": "eslint --ignore-path ./.eslintignore --ext .js,.ts .",
"lint:sol": "solhint \"contracts/**/*.sol\"",
"lint:sol:fix": "prettier --write \"contracts/**/*.sol\"",
"prettier": "prettier --config ./.prettierrc.yaml --write \"**/*.{js,json,md,ts,yaml,yml,sol}\"",
"prettier:check": "prettier --check --config ./.prettierrc.yaml \"**/*.{js,json,md,ts,yaml,yml,sol}\"",
"docgen": "hardhat docgen"
"prettier": "prettier --write \"**/*.{js,json,md,ts,yaml,yml,sol}\"",
"prettier:check": "prettier --check \"**/*.{js,json,md,ts,yaml,yml,sol}\"",
"docgen": "hardhat docgen",
"prepare": "husky install"
},
"repository": "[email protected]:VenusProtocol/venus-protocol.git",
"author": "Venus",
"license": "BSD-3-Clause",
"dependencies": {
"@openzeppelin/contracts-upgradeable": "^4.8.0",
"dotenv": "^16.0.1"
Expand All @@ -32,6 +33,8 @@
"hardhat": "^2.10.1"
},
"devDependencies": {
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
"@defi-wonderland/smock": "^2.2.0",
"@ethersproject/abi": "^5.6.4",
"@ethersproject/abstract-provider": "^5",
Expand All @@ -41,9 +44,11 @@
"@nomicfoundation/hardhat-chai-matchers": "^1.0.2",
"@nomicfoundation/hardhat-network-helpers": "^1.0.4",
"@nomicfoundation/hardhat-toolbox": "^1.0.2",
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers",
"@nomiclabs/hardhat-etherscan": "^3.1.0",
"@openzeppelin/hardhat-upgrades": "^1.21.0",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@semantic-release/npm": "^9.0.1",
"@trivago/prettier-plugin-sort-imports": "^3.3.1",
"@typechain/ethers-v5": "^10.1.0",
"@typechain/hardhat": "^6.1.2",
Expand All @@ -61,14 +66,21 @@
"hardhat": "^2.10.1",
"hardhat-deploy": "^0.11.14",
"hardhat-gas-reporter": "^1.0.8",
"husky": "^8.0.1",
"prettier": "^2.7.1",
"prettier-plugin-solidity": "^1.0.0-beta.24",
"semantic-release": "^19.0.3",
"solhint": "^3.3.7",
"solidity-coverage": "^0.7.21",
"solidity-docgen": "^0.6.0-beta.30",
"ts-node": "^10.9.1",
"typechain": "^8.1.0",
"typescript": "^4.7.4",
"web3-utils": "^1.7.5"
},
"packageManager": "[email protected]",
"publishConfig": {
"access": "public",
"provenance": true
}
}
}
Loading

0 comments on commit e8ce7c7

Please sign in to comment.