-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: add automated releases and pre-commit hooks #289
Changes from 17 commits
5529529
7e2a0ea
e2c1698
b95f4ba
abbc6a0
3b82c97
fca10f6
0b4aeae
5d5fa38
3dd54d5
79b63eb
9a59a68
1e1cf0a
3392d1d
3a4e949
89863fa
d946f4a
8ce2d12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
{ "extends": ["@commitlint/config-conventional"] } | ||
{ | ||
"extends": ["@commitlint/config-conventional"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: 'publish' | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
publish: | ||
needs: ci | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: latest | ||
- run: npm install | ||
- run: npx semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
ci: | ||
needs: get-supported-node-versions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Use latest version of Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: latest | ||
- run: npm install | ||
- run: npm run lint:commit -- --to "${{ github.sha }}" | ||
- run: npm run lint:standard | ||
- run: npm run lint:ts-standard | ||
- run: npm run test | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no -- commitlint --edit "$1" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm run test | ||
npm run lint:standard -- --fix | ||
npm run lint:ts-standard -- --fix |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
branches: | ||
- master | ||
plugins: | ||
- - "@semantic-release/commit-analyzer" | ||
- releaseRules: | ||
- breaking: true | ||
release: major | ||
- revert: true | ||
release: patch | ||
- type: feat | ||
release: minor | ||
- type: fix | ||
release: patch | ||
- type: perf | ||
release: patch | ||
- type: docs | ||
release: patch | ||
- - "@semantic-release/release-notes-generator" | ||
- preset: conventionalcommits | ||
presetConfig: | ||
types: | ||
- type: build | ||
section: Build system / dependencies | ||
- type: ci | ||
section: CI | ||
- type: docs | ||
section: Documentation | ||
- type: feat | ||
section: Features | ||
- type: fix | ||
section: Bug fixes | ||
- type: perf | ||
section: Performance | ||
- type: refactor | ||
section: Refactoring | ||
- type: text | ||
section: Testing | ||
- "@semantic-release/changelog" | ||
- "@semantic-release/github" | ||
- "@semantic-release/npm" | ||
- - "@semantic-release/git" | ||
- assets: | ||
- CHANGELOG.md | ||
- package.json | ||
Comment on lines
+42
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That might be best to not have any assets. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CHANGELOG.md package.json There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See #289 (comment) regarding package.json. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Contributing | ||
|
||
I welcome all pull requests. Please make sure you add appropriate test cases for any features | ||
added. | ||
|
||
> New to contributing? Check out [this How to Contribute guide](https://opensource.guide/how-to-contribute/). | ||
|
||
## Setup | ||
|
||
It is assumed that you already have a copy of this project. | ||
|
||
To setup your development environment, run the following command inside the project folder: | ||
|
||
```sh | ||
npm install | ||
``` | ||
|
||
This will install the required tools, dependencies, and git hooks. | ||
|
||
## Committing | ||
|
||
We follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and this is enforced by commitlint. Commits with incorrectly formatted messages will result in an error from git and the commit to be rejected. | ||
|
||
When committing, tests and linters are also run. If any of them fail, git will throw an error and the commit will be rejected. | ||
|
||
> Note that linters are run with the `--fix` argument, so any fixable issues will be fixed automatically. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@theoludwig what are your thoughts on using a Personal Access Token instead of the default
GITHUB_TOKEN
secret that GitHub provides?From a note in semantic-release's documentation:
I'm unsure to whether ts-standard has branch protection enabled on the master branch (I'm guessing yes).