Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Commit

Permalink
ci: add semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdef1cafe committed Sep 20, 2021
1 parent 92a23ff commit 3fd210e
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 8 deletions.
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Please ensure your PR is named in accordance with the [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional#type-enum) standard.

Prefixes can be one of the following characters
```
['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test']
```

✅ Examples of conforming PR titles:

```
feat: widgets can now do backflips
fix: something was broken
test: added more coverage to widget
```
7 changes: 4 additions & 3 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: commitlint/lint/test/build
name: Commitlint Lint Test & Build

on:
pull_request:
Expand All @@ -14,15 +14,16 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Commit lint
uses: wagoid/commitlint-github-action@v4
- name: Cache dependencies
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install
run: yarn install --frozen-lockfile
# needs to run after install
- name: Commitlint PR title
run: echo ${{ github.event.pull_request.title }} | npx commitlint
- name: Type check
run: yarn type-check
- name: Lint
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release
on:
push:
branches:
- main
- semantic-release # REMOVE THIS

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Commit lint
uses: wagoid/commitlint-github-action@v4
- name: Cache dependencies
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install
run: yarn install --frozen-lockfile
- name: Type check
run: yarn type-check
- name: Lint
run: yarn lint
- name: Test
run: yarn test
- name: Build
run: yarn build
- name: Release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: yarn release
17 changes: 12 additions & 5 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
{
"branches": "develop",
"dryRun": true,
"branches": ["main", "semantic-release"],
"repositoryUrl": "https://github.com/shapeshift/lib",
"debug": "true",
"plugins": [
"@semantic-release/commit-analyzer",
["@semantic-release/commit-analyzer", {
"preset": "angular",
"releaseRules": [
{ "type": "chore", "release": "patch" },
{ "type": "test", "release": "patch" }
]
}],
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
"@semantic-release/npm",
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": ["package.json", "package-lock.json", "CHANGELOG.md"],
"assets": ["dist/**", "package.json", "package-lock.json", "CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
Expand Down
Empty file added CHANGELOG.md
Empty file.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"test": "jest",
"test:dev": "jest --watch",
"type-check": "lerna run type-check",
"release": "lerna exec --concurrency 1 -- npx --no-install semantic-release -e semantic-release-monorepo",
"publish:lerna": "lerna publish from-package --no-private --yes",
"version:patch": "lerna version patch --yes --no-git-tag-version --no-push",
"version:minor": "lerna version minor --yes --no-git-tag-version --no-push",
Expand Down

0 comments on commit 3fd210e

Please sign in to comment.