Skip to content

Commit

Permalink
chore: semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
leoreisdias committed Aug 21, 2023
1 parent 65ce7f8 commit eb4d176
Show file tree
Hide file tree
Showing 4 changed files with 4,017 additions and 89 deletions.
69 changes: 57 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,64 @@
# .github/workflows/publish.yml
# 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
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: [ main ]
paths:
- 'package.json'
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
- run: npm run build --if-present
#- run: npm test

publish:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
needs: [build]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 14
- run: npm install
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
- run: npm run semantic-release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"build": "tsc",
"prepare": "npm run build",
"version": "git add -A src",
"postversion": "git push && git push --tags"
"postversion": "git push && git push --tags",
"semantic-release": "semantic-release"
},
"dependencies": {
"csstype": "^3.0.11",
Expand All @@ -22,6 +23,7 @@
"@types/node": "^16.4.6",
"ts-node-dev": "^1.1.8",
"typescript": "^4.3.5",
"semantic-release": "^21.0.9"
},
"files": [
"lib/**/*"
Expand All @@ -41,5 +43,9 @@
"bugs": {
"url": "https://github.com/leoreisdias/excel-ent/issues"
},
"release": { "branches": [ "main" ] }
"release": {
"branches": [
"main"
]
}
}
Loading

0 comments on commit eb4d176

Please sign in to comment.