Skip to content

Commit

Permalink
feat: add semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtek-krysiak committed Jun 12, 2020
1 parent 4c36765 commit 13ddc94
Show file tree
Hide file tree
Showing 5 changed files with 4,051 additions and 100 deletions.
34 changes: 13 additions & 21 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ jobs:

publish:
name: Publish
if: contains(github.ref, 'refs/tags')
needs: test
runs-on: ubuntu-latest
steps:
Expand All @@ -64,27 +63,20 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: '10.x'
- uses: filipstefansson/set-npm-token-action@v1
- uses: actions/cache@v1
id: yarn-cache
with:
token: ${{ secrets.NPM_TOKEN }}
- name: Publish beta
if: contains(github.ref, 'beta')
run: yarn publish --tag beta
- name: Publish
if: "!contains(github.ref, 'beta')"
run: yarn publish
- name: Generate Changelog
# this command extracts info about particular version from the changelog
run: |
awk -v ver=${GITHUB_REF##*/} '
/^## Version / { if (p) { exit }; if ($3 == ver) { p=1; next} } p && NF
' CHANGELOG.md > changelog-message.txt
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install
- name: Release
with:
body_path: changelog-message.txt
prerelease: contains(github.ref, 'beta')
uses: softprops/action-gh-release@v1
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}
JIRA_EMAIL: ${{ secrets.JIRA_EMAIL }}
run: yarn release
27 changes: 27 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"master",
"next",
"next-major",
{
"name": "beta",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git",
["semantic-release-jira-releases-sb", {
"projectId": "AB",
"releaseNameTemplate": "v${version}",
"jiraHost": "kmpgroup.atlassian.net",
"ticketPrefixes": [ "AB" ],
"released": true,
"setReleaseDate": true
}]
]
}
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',
],
}
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"simple": "nodemon examples/simple.js",
"test": "./node_modules/.bin/mocha spec/index.js",
"lint": "./node_modules/eslint/bin/eslint.js './examples/**/*.js' './plugin.js'"
"lint": "./node_modules/eslint/bin/eslint.js './examples/**/*.js' './plugin.js'",
"release": "semantic-release"
},
"repository": {
"type": "git",
Expand All @@ -30,6 +31,11 @@
"express-formidable": "^1.2.0",
"express-session": ">=1.15.6"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"devDependencies": {
"@types/express": "^4.17.4",
"@types/mocha": "^7.0.2",
Expand All @@ -46,6 +52,12 @@
"mongoose": "^5.3.16",
"nodemon": "^1.18.8",
"sinon": "^7.2.3",
"sinon-chai": "^3.3.0"
"sinon-chai": "^3.3.0",
"semantic-release": "^17.0.7",
"semantic-release-jira-releases-sb": "^0.7.2",
"@semantic-release/git": "^9.0.0",
"husky": "^4.2.5",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4"
}
}
Loading

0 comments on commit 13ddc94

Please sign in to comment.