Skip to content

Commit eb4d176

Browse files
committed
chore: semantic release
1 parent 65ce7f8 commit eb4d176

File tree

4 files changed

+4017
-89
lines changed

4 files changed

+4017
-89
lines changed

.github/workflows/publish.yml

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,64 @@
1-
# .github/workflows/publish.yml
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
4+
name: Node.js CI
5+
26
on:
37
push:
4-
branches: [ main ]
5-
paths:
6-
- 'package.json'
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
711

812
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
node-version: [18.x]
20+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'npm'
29+
- name: Install dependencies
30+
run: |
31+
if [ -e yarn.lock ]; then
32+
yarn install --frozen-lockfile
33+
elif [ -e package-lock.json ]; then
34+
npm ci
35+
else
36+
npm i
37+
fi
38+
- run: npm run build --if-present
39+
#- run: npm test
40+
941
publish:
1042
runs-on: ubuntu-latest
43+
if: ${{ github.ref == 'refs/heads/main' }}
44+
needs: [build]
1145
steps:
12-
- uses: actions/checkout@v1
13-
- uses: actions/setup-node@v1
14-
with:
15-
node-version: 14
16-
- run: npm install
17-
- uses: JS-DevTools/npm-publish@v1
18-
with:
19-
token: ${{ secrets.NPM_TOKEN }}
46+
- uses: actions/checkout@v3
47+
- name: Use Node.js ${{ matrix.node-version }}
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: ${{ matrix.node-version }}
51+
cache: 'npm'
52+
- run: |
53+
if [ -e yarn.lock ]; then
54+
yarn install --frozen-lockfile
55+
elif [ -e package-lock.json ]; then
56+
npm ci
57+
else
58+
npm i
59+
fi
60+
- run: npm run semantic-release
61+
env:
62+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"build": "tsc",
1313
"prepare": "npm run build",
1414
"version": "git add -A src",
15-
"postversion": "git push && git push --tags"
15+
"postversion": "git push && git push --tags",
16+
"semantic-release": "semantic-release"
1617
},
1718
"dependencies": {
1819
"csstype": "^3.0.11",
@@ -22,6 +23,7 @@
2223
"@types/node": "^16.4.6",
2324
"ts-node-dev": "^1.1.8",
2425
"typescript": "^4.3.5",
26+
"semantic-release": "^21.0.9"
2527
},
2628
"files": [
2729
"lib/**/*"
@@ -41,5 +43,9 @@
4143
"bugs": {
4244
"url": "https://github.com/leoreisdias/excel-ent/issues"
4345
},
44-
"release": { "branches": [ "main" ] }
46+
"release": {
47+
"branches": [
48+
"main"
49+
]
50+
}
4551
}

0 commit comments

Comments
 (0)