Skip to content

Commit

Permalink
feat(ci): add semantic-release
Browse files Browse the repository at this point in the history
  • Loading branch information
i7N3 committed Dec 28, 2022
1 parent eec296f commit ab4977f
Show file tree
Hide file tree
Showing 7 changed files with 2,033 additions and 58 deletions.
53 changes: 36 additions & 17 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,51 @@
# 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 - Publish package to npm
name: Node.js CI - Build and Publish package to NPM

on:
push:
branches: [ "main" ]
branches: ['main']
pull_request:
branches: [ "main" ]
branches: ['main']

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [14.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build project
run: pnpm build
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build project
run: pnpm build
publish:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
needs: [build]
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm semantic-release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14.19.1
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ dist
node_modules
vite.config.ts
jest.config.ts
.github
7 changes: 0 additions & 7 deletions CHANGELOG.md

This file was deleted.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,6 @@ const hasAccess = hasGrantedAnyScopeGoogle(
4. Now you can add `.tgz` file to your project and test changes. Run `pnpm add ~/path-to-tgz-file.tgz` to add package to your project.
5. Create Pull request with new changes.

Inspired by [react-oauth](https://github.com/MomenSherif/react-oauth)
> Commit with `pnpm commit`!
**Inspired by** [react-oauth](https://github.com/MomenSherif/react-oauth)
17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "google-oauth-library",
"private": true,
"version": "0.0.1",
"version": "0.0.0-development",
"main": "./dist/google-oauth-library.cjs",
"module": "./dist/google-oauth-library.mjs",
"types": "./dist/google-oauth-library.d.ts",
Expand All @@ -19,23 +19,36 @@
"build": "tsc && vite build && dts-bundle-generator --config ./dts-bundle-generator.config.ts",
"test": "jest --runInBand",
"test:coverage": "jest --runInBand --coverage",
"lint:scripts": "eslint . --ext .ts"
"lint:scripts": "eslint . --ext .ts",
"commit": "git-cz",
"semantic-release": "semantic-release --branches main"
},
"devDependencies": {
"@types/jest": "^29.0.0",
"@types/jsdom": "^20.0.0",
"@types/node": "^18.7.16",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"cz-conventional-changelog": "^3.3.0",
"dts-bundle-generator": "^6.13.0",
"eslint": "^8.23.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^28.1.3",
"prettier": "^2.7.1",
"semantic-release": "^19.0.5",
"ts-jest": "^28.0.8",
"ts-node": "^10.9.1",
"typescript": "^4.8.3",
"vite": "^3.1.0"
},
"repository": {
"type": "git",
"url": "https://github.com/i7N3/google-oauth-library.git"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
Loading

0 comments on commit ab4977f

Please sign in to comment.