Skip to content

Commit e1280f0

Browse files
authored
build: add automate release (#19)
1 parent 48089d0 commit e1280f0

File tree

7 files changed

+144
-31
lines changed

7 files changed

+144
-31
lines changed

.bumpedrc

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
version: 2
22
updates:
33
- package-ecosystem: npm
4-
directory: "/"
4+
directory: '/'
55
schedule:
66
interval: daily
7-
- package-ecosystem: "github-actions"
8-
directory: "/"
7+
- package-ecosystem: 'github-actions'
8+
directory: '/'
99
schedule:
1010
# Check for updates to GitHub Actions every weekday
11-
interval: "daily"
11+
interval: 'daily'

.github/workflows/main.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: main
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
contributors:
10+
if: "${{ github.event.head_commit.message != 'build: contributors' }}"
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: lts/*
22+
- name: Contributors
23+
run: |
24+
git config --global user.email ${{ secrets.GIT_EMAIL }}
25+
git config --global user.name ${{ secrets.GIT_USERNAME }}
26+
npm run contributors
27+
- name: Push changes
28+
uses: ad-m/github-push-action@master
29+
with:
30+
github_token: ${{ secrets.GH_TOKEN }}
31+
branch: ${{ github.head_ref }}
32+
33+
release:
34+
if: ${{ !startsWith(github.event.head_commit.message, 'chore(release):') && !startsWith(github.event.head_commit.message, 'docs:') && !startsWith(github.event.head_commit.message, 'ci:') }}
35+
needs: [contributors]
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v3
40+
with:
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
- name: Setup Node.js
43+
uses: actions/setup-node@v3
44+
with:
45+
node-version: lts/*
46+
- name: Install
47+
run: npm install --no-package-lock
48+
- name: Test
49+
run: npm test
50+
- name: Report
51+
run: mkdir -p coverage && npx c8 report --reporter=text-lcov > coverage/lcov.info
52+
- name: Coverage
53+
uses: coverallsapp/github-action@master
54+
with:
55+
github-token: ${{ secrets.GITHUB_TOKEN }}
56+
- name: Release
57+
env:
58+
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GH_TOKEN }}
59+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
60+
run: |
61+
git config --global user.email ${{ secrets.GIT_EMAIL }}
62+
git config --global user.name ${{ secrets.GIT_USERNAME }}
63+
git pull origin master
64+
npm run release

.github/workflows/pull_request.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: pull_request
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
test:
13+
if: github.ref != 'refs/heads/master'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: lts/*
24+
- name: Install
25+
run: npm install --no-package-lock
26+
- name: Test
27+
run: npm test
28+
- name: Report
29+
run: mkdir -p coverage && npx c8 report --reporter=text-lcov > coverage/lcov.info
30+
- name: Coverage
31+
uses: coverallsapp/github-action@master
32+
with:
33+
github-token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ coverage
3131
############################
3232
.node_history
3333
lib
34+
.env*

.travis.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

package.json

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,20 @@
4545
"devDependencies": {
4646
"mocha": "latest",
4747
"should": "latest",
48+
"@commitlint/cli": "latest",
49+
"@commitlint/config-conventional": "latest",
50+
"c8": "latest",
51+
"ci-publish": "latest",
52+
"conventional-github-releaser": "latest",
53+
"finepack": "latest",
54+
"git-authors-cli": "latest",
55+
"nano-staged": "latest",
56+
"npm-check-updates": "latest",
57+
"prettier-standard": "latest",
58+
"simple-git-hooks": "latest",
4859
"standard": "latest",
49-
"standard-markdown": "latest"
60+
"standard-markdown": "latest",
61+
"standard-version": "latest"
5062
},
5163
"engines": {
5264
"node": ">=8"
@@ -58,12 +70,40 @@
5870
"scripts": {
5971
"lint": "standard-markdown && standard",
6072
"pretest": "npm run lint",
61-
"test": "mocha"
73+
"test": "c8 mocha",
74+
"contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
75+
"postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
76+
"prerelease": "npm run update:check",
77+
"release:github": "conventional-github-releaser -p angular",
78+
"release:tags": "git push --follow-tags origin HEAD:master",
79+
"release": "standard-version -a",
80+
"update:check": "ncu -- --error-level 2",
81+
"update": "ncu -u"
6282
},
6383
"license": "MIT",
6484
"standard": {
6585
"env": [
6686
"mocha"
6787
]
88+
},
89+
"commitlint": {
90+
"extends": [
91+
"@commitlint/config-conventional"
92+
]
93+
},
94+
"nano-staged": {
95+
"*.js,!*.min.js,": [
96+
"prettier-standard"
97+
],
98+
"*.md": [
99+
"standard-markdown"
100+
],
101+
"package.json": [
102+
"finepack"
103+
]
104+
},
105+
"simple-git-hooks": {
106+
"commit-msg": "npx commitlint --edit",
107+
"pre-commit": "npx nano-staged"
68108
}
69109
}

0 commit comments

Comments
 (0)