Skip to content

Commit 19e0e89

Browse files
ci: add semantic release
1 parent 7cc4453 commit 19e0e89

File tree

5 files changed

+4254
-162
lines changed

5 files changed

+4254
-162
lines changed

.github/workflows/push.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ jobs:
9595

9696
publish:
9797
name: Publish
98-
if: contains(github.ref, 'refs/tags')
9998
needs: test
10099
runs-on: ubuntu-latest
101100
steps:
@@ -105,27 +104,22 @@ jobs:
105104
uses: actions/setup-node@v1
106105
with:
107106
node-version: '10.x'
108-
- uses: filipstefansson/set-npm-token-action@v1
107+
- uses: actions/cache@v1
108+
id: yarn-cache
109109
with:
110-
token: ${{ secrets.NPM_TOKEN }}
111-
- name: Publish beta
112-
if: contains(github.ref, 'beta')
113-
run: yarn publish --tag beta
114-
- name: Publish
115-
if: "!contains(github.ref, 'beta')"
116-
run: yarn publish
117-
- name: Generate Changelog
118-
# this command extracts info about particular version from the changelog
119-
run: |
120-
awk -v ver=${GITHUB_REF##*/} '
121-
/^## Version / { if (p) { exit }; if ($3 == ver) { p=1; next} } p && NF
122-
' CHANGELOG.md > changelog-message.txt
110+
path: node_modules
111+
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
112+
restore-keys: |
113+
${{ runner.os }}-node_modules-
114+
- name: Install
115+
if: steps.yarn-cache.outputs.cache-hit != 'true'
116+
run: yarn install
123117
- name: Release
124-
with:
125-
body_path: changelog-message.txt
126-
prerelease: contains(github.ref, 'beta')
127-
uses: softprops/action-gh-release@v1
128118
env:
119+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
129120
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}
122+
JIRA_EMAIL: ${{ secrets.JIRA_EMAIL }}
123+
run: yarn release
130124

131125

.releaserc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"branches": [
3+
"+([0-9])?(.{+([0-9]),x}).x",
4+
"master",
5+
"next",
6+
"next-major",
7+
{
8+
"name": "beta",
9+
"prerelease": true
10+
}
11+
],
12+
"plugins": [
13+
"@semantic-release/commit-analyzer",
14+
"@semantic-release/release-notes-generator",
15+
"@semantic-release/npm",
16+
"@semantic-release/github",
17+
"@semantic-release/git",
18+
["semantic-release-jira-releases-sb", {
19+
"projectId": "AB",
20+
"releaseNameTemplate": "v${version}",
21+
"jiraHost": "kmpgroup.atlassian.net",
22+
"ticketPrefixes": [ "AB" ],
23+
"released": true,
24+
"setReleaseDate": true
25+
}]
26+
]
27+
}

CHANGELOG.md

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

package.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"test": "./node_modules/mocha/bin/mocha spec/index.js",
88
"cover": "NODE_ENV=test ./node_modules/nyc/bin/nyc.js --reporter=html -x=spec -x=coverage --all=true npm test",
99
"sequelize": "./node_modules/.bin/sequelize",
10-
"lint": "./node_modules/eslint/bin/eslint.js './spec/**/*.js' './src/**/*.js'"
10+
"lint": "./node_modules/eslint/bin/eslint.js './spec/**/*.js' './src/**/*.js'",
11+
"release": "semantic-release"
1112
},
1213
"repository": {
1314
"type": "git",
@@ -19,6 +20,11 @@
1920
"admin-bro": ">=2.2.0",
2021
"sequelize": ">=4"
2122
},
23+
"husky": {
24+
"hooks": {
25+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
26+
}
27+
},
2228
"devDependencies": {
2329
"admin-bro": "^2.2.0",
2430
"chai": "^4.2.0",
@@ -34,7 +40,13 @@
3440
"sequelize": "^4.42.0",
3541
"sequelize-cli": "^5.4.0",
3642
"sinon": "^7.1.1",
37-
"sinon-chai": "^3.3.0"
43+
"sinon-chai": "^3.3.0",
44+
"husky": "^4.2.5",
45+
"@commitlint/cli": "^8.3.5",
46+
"@commitlint/config-conventional": "^8.3.4",
47+
"semantic-release": "^17.0.7",
48+
"semantic-release-jira-releases-sb": "^0.7.2",
49+
"@semantic-release/git": "^9.0.0"
3850
},
3951
"dependencies": {
4052
"escape-regexp": "0.0.1"

0 commit comments

Comments
 (0)