Skip to content

Commit c2f9c36

Browse files
authored
Merge pull request #16 from Ridermansb/semantic-release-build
semantic release build
2 parents a6829f8 + 3697844 commit c2f9c36

File tree

12 files changed

+3730
-79
lines changed

12 files changed

+3730
-79
lines changed

.eslintrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@
1818
},
1919
"plugins": ["import", "@typescript-eslint", "react"],
2020
"settings": { "react": { "version": "detect" } },
21+
"overrides": [
22+
{
23+
"files": ["release.config.js", "commitlint.config.js"],
24+
"env": {
25+
"node": true
26+
},
27+
"rules": {
28+
"no-template-curly-in-string": "off"
29+
}
30+
}
31+
],
2132
"rules": {
2233
"@typescript-eslint/no-misused-promises": "off",
2334
"@typescript-eslint/no-floating-promises": "off",

.github/workflows/CI.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@ jobs:
1818
with:
1919
node-version: ${{ matrix.node-version }}
2020

21+
- name: Install Dependencies
22+
run: yarn install --frozen-lockfile --silent --non-interactive
23+
24+
- name: Test
25+
run: yarn lint
26+
2127
- name: Build
22-
run: |
23-
yarn
24-
yarn build
25-
26-
- name: Publish
27-
uses: softprops/action-gh-release@v1
28-
if: startsWith(github.ref, 'refs/tags/')
29-
env:
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
with:
32-
files: ./dist/*.zip
28+
run: yarn build

.github/workflows/publish.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Publish
2+
3+
on:
4+
workflow_dispatch:
5+
milestone:
6+
types: [ closed ]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
node-version: [16.x]
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
24+
- uses: chrnorm/deployment-action@releases/v1
25+
name: Create GitHub deployment
26+
id: deployment
27+
with:
28+
token: ${{ github.token }}
29+
description: Build from ${{ github.sha }} because of ${{ github.event_name }} by ${{ github.actor }}
30+
31+
- name: Install Dependencies
32+
run: yarn install --frozen-lockfile --silent --non-interactive
33+
34+
- name: Semantic Release
35+
env:
36+
GH_TOKEN: ${{ github.token }}
37+
GITHUB_TOKEN: ${{ github.token }}
38+
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
39+
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
40+
GOOGLE_REFRESH_TOKEN: ${{ secrets.GOOGLE_REFRESH_TOKEN }}
41+
run: yarn semantic-release
42+
43+
- name: Update deployment status (success)
44+
if: success()
45+
uses: chrnorm/deployment-status@releases/v1
46+
with:
47+
token: ${{ github.token }}
48+
state: "success"
49+
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
50+
51+
- name: Update deployment status (failure)
52+
if: failure()
53+
uses: chrnorm/deployment-status@releases/v1
54+
with:
55+
token: ${{ github.token }}
56+
state: "failure"
57+
deployment_id: ${{ steps.deployment.outputs.deployment_id }}

.husky/commit-msg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
3+
. "$(dirname -- "$0")/_/husky.sh"
4+
5+
yarn commitlint --edit $1
6+
npx --no -- commitlint --edit

CONTRIBUTING.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
2+
3+
## How to contribute
4+
5+
1. Ensure you have [nvm][nvm] and [node][node] installed in your machine
6+
2. Ensure you have [yarn][yarn] installed in your machine
7+
3. Nice to have [gh cli][ghcli]
8+
9+
### Development
10+
11+
Install the dependencies
12+
13+
```bash
14+
nvm use
15+
yarn
16+
```
17+
18+
Create another branch for your changes
19+
20+
```bash
21+
git checkout -b my-feature
22+
```
23+
24+
Run development environment
25+
26+
```bash
27+
yarn dev
28+
```
29+
30+
Commit your changes
31+
32+
```bash
33+
git add .
34+
yarn commit
35+
```
36+
37+
### Pushing changes
38+
39+
Create Pull Request
40+
41+
> You can use [gh cli](https://cli.github.com/) to create Pull Request
42+
> `gh pr create --fill --web`
43+
44+
Once get approval, merge your changes
45+
46+
47+
48+
<!-- links -->
49+
50+
[nvm]: https://github.com/nvm-sh/nvm
51+
[node]: https://nodejs.org/en/
52+
[yarn]: https://classic.yarnpkg.com/en/
53+
[ghcli]: https://cli.github.com/

build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
export VERSION=$1
4+
5+
yarn run build
6+
7+
zip -q -r invoice-generator-v"$VERSION".zip dist/

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

package.json

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
"name": "invoice-generator",
33
"description": "Invoice generator",
44
"license": "MIT",
5-
"version": "3.0.2",
5+
"version": "",
66
"private": true,
77
"scripts": {
88
"dev": "tsc && vite build --watch",
99
"format": "prettier --write .",
1010
"lint": "eslint . --ext .ts,.tsx",
1111
"lint:fix": "$npm_execpath lint --fix",
1212
"build": "tsc && vite build",
13-
"postinstall": "husky install"
13+
"postinstall": "husky install",
14+
"semantic-release": "semantic-release",
15+
"commit": "git-cz"
1416
},
1517
"dependencies": {
1618
"bootstrap": "^5.1.3",
@@ -23,7 +25,11 @@
2325
"react-dom": "^18.2.0"
2426
},
2527
"devDependencies": {
26-
"@types/chrome": "^0.0.190",
28+
"@commitlint/cli": "^17.1.2",
29+
"@commitlint/config-conventional": "^17.1.0",
30+
"@semantic-release/exec": "^6.0.3",
31+
"@semantic-release/github": "^8.0.6",
32+
"@types/chrome": "^0.0.197",
2733
"@types/jspdf": "^2.0.0",
2834
"@types/node": "^17.0.42",
2935
"@types/react": "^18.0.4",
@@ -32,6 +38,8 @@
3238
"@typescript-eslint/eslint-plugin": "^5.30.6",
3339
"@typescript-eslint/parser": "^5.30.6",
3440
"@vitejs/plugin-react": "^1.3.2",
41+
"commitizen": "^4.2.5",
42+
"cz-conventional-changelog": "3.3.0",
3543
"eslint": "^8.20.0",
3644
"eslint-config-prettier": "^8.5.0",
3745
"eslint-plugin-import": "^2.26.0",
@@ -42,8 +50,32 @@
4250
"prettier": "^2.7.1",
4351
"rollup-plugin-copy": "^3.4.0",
4452
"sass": "^1.52.3",
53+
"semantic-release": "^19.0.5",
4554
"typescript": "^4.7.3",
4655
"vite": "^2.9.12",
4756
"vite-plugin-auto-zip": "^1.0.4"
57+
},
58+
"contributors": [
59+
{
60+
"name": "Riderman",
61+
"url": "https://github.com/ridermansb"
62+
},
63+
{
64+
"name": "silvioprog",
65+
"email": "soliveira@securityscorecard.io"
66+
},
67+
{
68+
"name": "Daniel Parisotto",
69+
"email": "dhp_parisotto@hotmail.com"
70+
}
71+
],
72+
"repository": {
73+
"type": "git",
74+
"url": "https://github.com/risoflora/invoice-generator.git"
75+
},
76+
"config": {
77+
"commitizen": {
78+
"path": "./node_modules/cz-conventional-changelog"
79+
}
4880
}
4981
}

release.config.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
branches: ['main'],
3+
plugins: [
4+
'@semantic-release/commit-analyzer',
5+
'@semantic-release/release-notes-generator',
6+
[
7+
'@semantic-release/exec',
8+
{
9+
prepareCmd: 'sh ./build.sh v${nextRelease.version}'
10+
}
11+
],
12+
[
13+
'@semantic-release/github',
14+
{
15+
assets: [
16+
{
17+
path: './invoice-generator-v${nextRelease.version}.zip',
18+
label: 'Distribution files.zip'
19+
}
20+
]
21+
}
22+
],
23+
[
24+
'semantic-release-chrome',
25+
{
26+
extensionId: 'obdabdocagpfclncklefebhhgggkbbnk',
27+
asset: 'invoice-generator-v${nextRelease.version}.zip'
28+
}
29+
]
30+
]
31+
};

tsconfig.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"compilerOptions": {
33
"target": "ESNext",
44
"useDefineForClassFields": true,
5-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
65
"allowJs": false,
76
"skipLibCheck": false,
87
"esModuleInterop": true,
@@ -14,7 +13,15 @@
1413
"resolveJsonModule": true,
1514
"isolatedModules": true,
1615
"noEmit": true,
17-
"jsx": "react-jsx"
16+
"jsx": "react-jsx",
17+
"lib": ["dom", "dom.iterable", "esnext", "es5", "es2015.promise"],
18+
"types": [
19+
"react",
20+
"node",
21+
"react-dom",
22+
"chrome"
23+
],
24+
"typeRoots": ["./src/@types", "./node_modules/@types"]
1825
},
1926
"include": ["src"],
2027
"references": [{ "path": "./tsconfig.node.json" }]

0 commit comments

Comments
 (0)