Skip to content

Commit

Permalink
feat: STRF-10157 Introduce Semantic Release (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
jairo-bc authored Oct 26, 2022
1 parent a566be4 commit 8d4376f
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 8 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Build
name: Lint and Test PR

on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]

jobs:
build:
Expand All @@ -27,6 +25,12 @@ jobs:
- name: Install Dependencies
run: npm i

- name: Verify Github PR Title
run: echo "${{ github.event.pull_request.title }}" | npx commitlint

- name: Verify Git Commit Name
run: git log -1 --pretty=format:"%s" | npx commitlint

- name: Lint the code
run: npm run lint

Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
name: Paper Library
name: Paper Library Semantic Release

on:
release:
types: [created]
push:
branches: [master, main]


jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -11,6 +14,13 @@ jobs:
with:
node-version: '14.x'
- run: npm i
- name: Check Git Commit name
run: git log -1 --pretty=format:"%s" | npx commitlint
# Setup .npmrc file to publish to npm registry
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
- run: npm publish
- name: Deploy to npm and git
run: npm config list && npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GA_USERNAME: ${{ secrets.PAT_USERNAME }}
GA_TOKEN: ${{ secrets.PAT_TOKEN }}
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx commitlint --edit $1
20 changes: 20 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"branches": ["master"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
["@semantic-release/github", {
"assets": [
{"path": "dist/blackbird-handlebars.js", "label": "helpers.js"}
]
}],
"@semantic-release/npm",
[
"semantic-release-github-pullrequest", {
"assets": ["CHANGELOG.md", "package.json"],
"baseRef": "master"
}
]
]
}
6 changes: 6 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [0, 'always', 'sentence-case'],
}
};
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"lint": "eslint .",
"lint-and-fix": "eslint . --fix",
"test": "lab -v -t 95 --ignore i18n,WebAssembly,SharedArrayBuffer,Atomics,BigUint64Array,BigInt64Array,BigInt,URL,URLSearchParams,TextEncoder,TextDecoder,queueMicrotask,FinalizationRegistry,WeakRef,plural,en,number,select spec",
"coverage": "lab -c -r console -o stdout -r html -o coverage.html spec"
"coverage": "lab -c -r console -o stdout -r html -o coverage.html spec",
"release": "semantic-release"
},
"repository": {
"type": "git",
Expand All @@ -29,9 +30,20 @@
"messageformat": "~0.2.2"
},
"devDependencies": {
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/commit-analyzer": "^9.0.2",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^8.0.6",
"@semantic-release/npm": "^9.0.1",
"@semantic-release/release-notes-generator": "^10.0.3",
"code": "~4.0.0",
"eslint": "^7.8.1",
"husky": "^8.0.1",
"lab": "~13.0.1",
"semantic-release": "^19.0.5",
"semantic-release-github-pullrequest": "^1.3.0",
"sinon": "~7.5.0"
}
}

0 comments on commit 8d4376f

Please sign in to comment.