mirror of
https://github.com/chenasraf/express-otp.git
synced 2026-05-17 17:48:11 +00:00
build: use semantic release
This commit is contained in:
54
.github/workflows/develop.yml
vendored
54
.github/workflows/develop.yml
vendored
@@ -1,54 +0,0 @@
|
||||
name: Alpha Releases
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop, fix/*, feature/*]
|
||||
# pull_request:
|
||||
# branches: [master, develop]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '14.x'
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn test
|
||||
- run: yarn build
|
||||
- run: cd ./build && yarn pack --filename=../package.tgz
|
||||
if: "contains(github.event.head_commit.message, '[publish]')"
|
||||
- uses: Klemensas/action-autotag@stable
|
||||
if: "contains(github.event.head_commit.message, '[publish]')"
|
||||
id: update_tag
|
||||
with:
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||
tag_prefix: 'v'
|
||||
- name: Publish on NPM
|
||||
uses: JS-DevTools/npm-publish@v1
|
||||
if: "contains(github.event.head_commit.message, '[publish]')"
|
||||
with:
|
||||
package: ./build/package.json
|
||||
token: '${{ secrets.NPM_TOKEN }}'
|
||||
- name: Create Release
|
||||
if: steps.update_tag.outputs.tagname && contains(github.event.head_commit.message, '[publish]')
|
||||
uses: actions/create-release@v1
|
||||
id: create_release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
prerelease: true
|
||||
tag_name: ${{ steps.update_tag.outputs.tagname }}
|
||||
release_name: Release ${{ steps.update_tag.outputs.tagname }}
|
||||
- name: Upload Release Asset
|
||||
if: steps.update_tag.outputs.tagname && contains(github.event.head_commit.message, '[publish]')
|
||||
id: upload-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./package.tgz
|
||||
asset_name: express-otp ${{ steps.update_tag.outputs.tagname }}.tgz
|
||||
asset_content_type: application/tgz
|
||||
50
.github/workflows/release.yml
vendored
50
.github/workflows/release.yml
vendored
@@ -1,50 +0,0 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '14.x'
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn test
|
||||
- run: yarn build
|
||||
- run: cd ./build && yarn pack --filename=../package.tgz
|
||||
if: "!contains(github.event.head_commit.message, '[skip publish]')"
|
||||
- uses: Klemensas/action-autotag@stable
|
||||
if: "!contains(github.event.head_commit.message, '[skip publish]')"
|
||||
id: update_tag
|
||||
with:
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||
tag_prefix: 'v'
|
||||
- name: Publish on NPM
|
||||
uses: JS-DevTools/npm-publish@v1
|
||||
with:
|
||||
package: ./build/package.json
|
||||
token: '${{ secrets.NPM_TOKEN }}'
|
||||
- name: Create Release
|
||||
if: steps.update_tag.outputs.tagname && !contains(github.event.head_commit.message, '[skip publish]')
|
||||
uses: actions/create-release@v1
|
||||
id: create_release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ steps.update_tag.outputs.tagname }}
|
||||
release_name: Release ${{ steps.update_tag.outputs.tagname }}
|
||||
- name: Upload Release Asset
|
||||
if: steps.update_tag.outputs.tagname && !contains(github.event.head_commit.message, '[skip publish]')
|
||||
id: upload-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./package.tgz
|
||||
asset_name: express-otp ${{ steps.update_tag.outputs.tagname }}.tgz
|
||||
asset_content_type: application/tgz
|
||||
27
.github/workflows/semantic_release.yml
vendored
Normal file
27
.github/workflows/semantic_release.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Semantic Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, develop, feat/*, fix/*]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '14.x'
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn test
|
||||
- run: yarn semantic-release-pre
|
||||
env:
|
||||
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}'
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||
- run: yarn build
|
||||
- run: cd ./build && yarn pack --filename=../package.tgz
|
||||
if: "!contains(github.event.head_commit.message, '[skip publish]')"
|
||||
- run: yarn semantic-release-post
|
||||
env:
|
||||
NPM_TOKEN: '${{ secrets.NPM_TOKEN }}'
|
||||
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "express-otp",
|
||||
"version": "0.3.1",
|
||||
"version": "0.0.0-development",
|
||||
"description": "OTP auth for your nodejs/express app, as easy as it gets!",
|
||||
"main": "index.js",
|
||||
"repository": "https://github.com/chenasraf/express-otp",
|
||||
@@ -19,7 +19,8 @@
|
||||
"start": "concurrently \"tsc -w\" \"nodemon build/example/server.js\"",
|
||||
"build": "tsc -p tsconfig.build.json && ts-node scripts/build.ts",
|
||||
"docs": "typedoc --out docs src/index.ts",
|
||||
"test": "jest --coverage"
|
||||
"test": "jest --coverage",
|
||||
"semantic-release": "semantic-release"
|
||||
},
|
||||
"dependencies": {
|
||||
"hi-base32": "^0.5.1",
|
||||
@@ -31,6 +32,7 @@
|
||||
"@types/jest": "^29.2.3",
|
||||
"@types/node": "^18.11.9",
|
||||
"@types/qrcode": "^1.5.0",
|
||||
"@types/semantic-release": "^17.2.4",
|
||||
"@types/totp-generator": "^0.0.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.44.0",
|
||||
"@typescript-eslint/parser": "^5.44.0",
|
||||
@@ -40,6 +42,7 @@
|
||||
"express": "^4.18.2",
|
||||
"jest": "^29.3.1",
|
||||
"nodemon": "^2.0.20",
|
||||
"semantic-release": "^19.0.5",
|
||||
"ts-jest": "^29.0.3",
|
||||
"ts-node": "^10.9.1",
|
||||
"typedoc": "^0.23.21",
|
||||
|
||||
68
release.config.js
Normal file
68
release.config.js
Normal file
@@ -0,0 +1,68 @@
|
||||
/** @type {import('semantic-release').Options} */
|
||||
module.exports = {
|
||||
branches: ['master', 'develop', 'feat/*', 'fix/*'],
|
||||
analyzeCommits: {
|
||||
path: 'semantic-release-conventional-commits',
|
||||
majorTypes: ['major', 'breaking'],
|
||||
minorTypes: ['minor', 'feat', 'feature'],
|
||||
patchTypes: [
|
||||
'patch',
|
||||
'fix',
|
||||
'bugfix',
|
||||
'chore',
|
||||
'docs',
|
||||
'style',
|
||||
'refactor',
|
||||
'perf',
|
||||
'test',
|
||||
'build',
|
||||
'ci',
|
||||
'revert',
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
[
|
||||
'@semantic-release/commit-analyzer',
|
||||
{
|
||||
preset: 'conventionalcommits',
|
||||
releaseRules: [
|
||||
{ type: 'docs', hidden: true },
|
||||
{ type: 'feat', section: 'Features' },
|
||||
{ type: 'fix', section: 'Bug Fixes' },
|
||||
{ type: 'chore', hidden: true },
|
||||
{ type: 'style', hidden: true },
|
||||
{ type: 'refactor', hidden: true },
|
||||
{ type: 'perf', hidden: true },
|
||||
{ type: 'test', hidden: true },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
'@semantic-release/release-notes-generator',
|
||||
{
|
||||
preset: 'conventionalcommits',
|
||||
parserOpts: {
|
||||
noteKeywords: ['breaking'],
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
'@semantic-release/changelog',
|
||||
{
|
||||
changelogFile: 'CHANGELOG.md',
|
||||
},
|
||||
],
|
||||
[
|
||||
'@semantic-release/npm',
|
||||
{
|
||||
packageRoot: 'build',
|
||||
},
|
||||
],
|
||||
[
|
||||
'@semantic-release/github',
|
||||
{
|
||||
assets: ['build/**/*'],
|
||||
},
|
||||
],
|
||||
],
|
||||
}
|
||||
Reference in New Issue
Block a user